Skip to content

Instantly share code, notes, and snippets.

@gstricklind
gstricklind / functions.php
Last active January 25, 2018 01:38
Add data attribute with variable term_id to wp_list_categories
<?php
/*========================================================================
Filter wp_list_categories to add new attribute
========================================================================*/
add_filter('wp_list_categories','moons_ajax_onclick');
function moons_ajax_onclick($output){
//if (is_post_type_archive('crew')) { // localize this filter if needed
//if not using a CPT then change get_terms to get_categories
@gstricklind
gstricklind / styles.css
Created December 10, 2016 18:39
Tabbed WooCommerce My Account
body.woocommerce-account .woocommerce-MyAccount-navigation ul {
margin: 0;
}
body.woocommerce-account .woocommerce-MyAccount-navigation ul li {
list-style: none;
}
body.woocommerce-account .woocommerce-MyAccount-navigation ul li a {
text-decoration: none;
}
@gstricklind
gstricklind / style.css
Created October 5, 2016 02:05
CSS Long Shadow with Alpha Transparency
.long-shadow {
text-shadow: rgba(18, 128, 106,1) -1px 1px,
rgba(18, 128, 106,0.99) -2px 2px,
rgba(18, 128, 106,0.98) -3px 3px,
rgba(18, 128, 106,0.97) -4px 4px,
rgba(18, 128, 106,0.96) -5px 5px,
rgba(18, 128, 106,0.95) -6px 6px,
rgba(18, 128, 106,0.94) -7px 7px,
rgba(18, 128, 106,0.93) -8px 8px,
rgba(18, 128, 106,0.92) -9px 9px,
/*========================================================================
Tag Cloud Filter
========================================================================*/
add_filter('widget_tag_cloud_args', 'filter_tag_cloud_limit');
function filter_tag_cloud_limit($args){
$args['number'] = ''; // Removes limit on number of tags
return $args;
@gstricklind
gstricklind / functions.php
Created February 16, 2016 17:10
Code snippets from Genesis Framework presentation at WP meetup
<?
/*========================================================================
Custom CTA
========================================================================*/
// Show CTA above footer widgets
add_action('genesis_before_footer','moons_custom_cta_1', 1);
function moons_custom_cta_1() {
echo '<div class="cta"><div class="wrap">This is the call to action.</div></div>';
@gstricklind
gstricklind / functions.php
Last active August 7, 2017 02:19
Genesis Favicons
<?php
// Filter to customize favicon and add Apple Touch Icons
add_filter( 'genesis_pre_load_favicon', 'gs_pre_load_favicon');
function gs_pre_load_favicon() {
$favicon_directory = get_stylesheet_directory_uri() . '/images/';
echo '<link rel="shortcut icon" href="' . $favicon_directory . 'favicon.ico">'. PHP_EOL
.'<link rel="apple-touch-icon-precomposed" sizes="57x57" href="' . $favicon_directory . 'apple-touch-icon-57x57.png" />' . PHP_EOL
@gstricklind
gstricklind / functions.php
Last active December 14, 2021 19:03
Genesis: Recent Posts Shortcode With Category Option
<?
/*========================================================================
Custom Loop Shortcode
========================================================================*/
add_action('init' , 'gs_init');
function gs_init() {
add_shortcode( 'custom_post_feed', 'gs_custom_post_feed_shortcode_handler' );
//[custom_post_feed category="wisdom" show="1"]
@gstricklind
gstricklind / style.css
Last active November 12, 2015 05:46
Simple Social Icons: Colored Icons
/* Simple Social Icons
--------------------------------------------- */
.simple-social-icons li.social-dribbble a {
background-color: #049fb3 !important;
}
.simple-social-icons li.social-email a {
background-color: #049fb3 !important;
}
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
function enqueue_my_styles() {
global $wp_styles;
// Load the main stylesheet
wp_enqueue_style( 'my-theme', get_stylesheet_uri() );
@gstricklind
gstricklind / _page.php
Last active April 24, 2019 03:13
WordPress: Dynamically shows first level child pages of a parent page without using a widget or menu.
<?php
global $post;
if(!$post->post_parent){
$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
} else{
if($post->ancestors) {
//$ancestors = end($post->ancestors);
$ancestors = end( get_post_ancestors($post) );