Skip to content

Instantly share code, notes, and snippets.

View steve10287's full-sized avatar

Steve steve10287

  • Designamite
  • Exeter
View GitHub Profile
@steve10287
steve10287 / joomla-full-width-nav
Created February 5, 2015 19:59
Joomla Horizonal - Full width sub nav with images
/*Quick mockup of full width Joomla menu with background images on sub nav items*/
/*For ease of use adding names of products etc to image would be better then to absolute position the sub nav links with opacity 0*/
* {
box-sizing:border-box;
}
.menu {
position: relative;
}
ul {
list-style:none;
@steve10287
steve10287 / gist:c13d97fcc754c3c21a00
Created February 16, 2015 12:04
Simple Responsive Tabs with Accordion
<div class="tab-row">
<a href="#" data-tab="new-vehicles">New Vehicles</a>
<a href="#" data-tab="used-vehicles">Used Vehicles</a>
<a href="#" data-tab="new-trailers">New Trailers</a>
<a href="#" data-tab="used-trailers">Used Trailers</a>
</div>
<div class="tab-group">
<a href="#" class="new-vehicles tab-acc" data-tab="new-vehicles">New Vehicles</a>
<div class="tab-content new-vehicles">New Vehicle content</div>
<a href="#" class="used-vehicles tab-acc" data-tab="used-vehicles">Used Vehicles</a>
<?php
$channel_name = 'SubaruGlobalTV';//Be sure to change this to your channel
$count = 1;//# of videos you want to show (MAX = 20)
$em_width = "100%";//width of embedded player
$em_height = 500;//height of embedded player
$wrap_class = 'video';//class name for the div wrapper
//The output...
$sxml = simplexml_load_file("http://gdata.youtube.com/feeds/api/users/$channel_name/uploads?max-results=$count");
foreach ($sxml->entry as $entry) {
@steve10287
steve10287 / sjb-tabs.js
Created May 17, 2015 21:25
Ultra Simple JQuery Tabs / Drawers
/*!
* SJB Tabs v 0.1
* 14/05/2015
* @author: Steven Brown
*/
(function( $ )
{
$.fn.sjbtabs = function()
{
@steve10287
steve10287 / gist:6c2510b1a82f7a45e9ba
Created May 28, 2015 10:56
Convert Table to Responsive Table
/***
Convert finance tables into responsive tables
Loop thru each table header or in this cast tr:first child
Then add the title for the table header to the the td elements as a data attribute
Then in css: use :before {content: attr(data-content)}
***/
$('table.finance').each(function()
{
var nthChild = 1;
/***
Convert finance tables into responsive tables
Loop thru each table header or in this cast tr:first child
Then add the title for the table header to the the td elements as a data attribute
Then in css: use :before {content: attr(data-content)}
***/
$('table').each(function()
{
@steve10287
steve10287 / gist:5f88fdceab3e5bccc89a
Created June 22, 2015 12:35
Joomla 3 get category
//Get category id
$input=$app->input;
if ($input->getCmd('option')=='com_content'
&& $input->getCmd('view')=='article' ){
$cmodel = JModelLegacy::getInstance('Article', 'ContentModel');
$catid = $cmodel->getItem($app->input->get('id'))->catid;
}
@steve10287
steve10287 / sub-category-sorting.php
Last active March 9, 2017 11:33
Woocommerce Sub Category Sorting - Alphabetical
<?php
/**
Works with Woocommerce 2.6.14
You will need to replace the function with: http://woocommerce.wp-a2z.org/oik_api/woocommerce_product_subcategories/
If the below does not work & then apply:
usort($product_categories, function($a, $b)
{
@steve10287
steve10287 / 0_reuse_code.js
Created March 17, 2017 16:47
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@steve10287
steve10287 / canonical.php
Created October 12, 2017 11:58
Polylang Canonical Tags with Yoast's API
<?php
/**
This is used on a site where blog posts are in each english region, to avoid content duplication this method generates
the canonical for the main English site language
**/
function is_blog_page () {
global $post;
$posttype = get_post_type($post );