Skip to content

Instantly share code, notes, and snippets.

<?php
function dimox_breadcrumbs() {
/* === OPTIONS === */
$text['home'] = 'Home'; // text for the 'Home' link
$text['category'] = 'Archive by Category "%s"'; // text for a category page
$text['search'] = 'Search Results for "%s" Query'; // text for a search results page
$text['tag'] = 'Posts Tagged "%s"'; // text for a tag page
$text['author'] = 'Articles Posted by %s'; // text for an author page
@gstricklind
gstricklind / _content-page.php
Last active August 29, 2015 14:02
WordPress: Hide "Home" page title when front-page is set.
<?php if( !is_front_page() ):?>
<h1 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
<?php endif; ?>
@gstricklind
gstricklind / _functions-excerpts.php
Last active August 29, 2015 14:02
WordPress: Add number of post excerpts via shortcode
<?php
/**
* Excerpts Shortcode
*/
//[excerpts display="3"]
function kedc_shortcode_excerpts($atts) {
extract( shortcode_atts( array(
'display' => ''
), $atts) );
@gstricklind
gstricklind / _functions-widget_sitemap.php
Last active August 29, 2015 14:02
WordPress: Widget - mini sitemap. Allows for menus to be set and with the option to display these in one column or two column. Ideal for theme widget areas that don't need to be too small so the user can use the area for something else later if needed.
<?php
/**
* Create advanced widget for mini sitemap
*/
class kedc_mini_sitemap extends WP_Widget {
/*constructor*/
public function __construct() {
parent::WP_Widget(false, $name = 'Mini Sitemap');
}
@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) );
<?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 / 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;
}
@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 / 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
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>';