Skip to content

Instantly share code, notes, and snippets.

jQuery(document).ready(function($) {
$("body").backstretch([BackStretchImg.src],{duration:3000,fade:750});
});
@cdils
cdils / customtaxonomyarchives.php
Last active December 10, 2015 17:48
I wanted to have a page similar to the Portfolio Archive in the Minimum Theme (http://demo.studiopress.com/minimum/portfolio/). Only catch is that theme is using a CPT archive and I want to populate my page with a custom taxonomy instead. This code is used in a page template and will loop through taxonomy terms (I only want parent tax terms) and…
<?php
add_action( 'genesis_loop', 'cd_custom_taxonomy_archives' );
function cd_custom_taxonomy_archives() {
//print the page title
the_title('<h1 class="entry-title">', '</h1>');
// Code sample modified from example on http://wordpress.mfields.org/plugins/taxonomy-images/
// This filter pulls similar results to get_terms(), except it also includes an image reference
$terms = apply_filters( 'taxonomy-images-get-terms', '', array('taxonomy' =>'your-tax-name') );
@cdils
cdils / conditionalcomments.php
Last active December 11, 2015 02:49
Conditionally show comments on a post based on the post author. Code specific to Genesis Framework. Regferehttp://codex.wordpress.org/Function_Reference/get_the_author
// Remove comments from posts
remove_action( 'genesis_after_post', 'genesis_get_comments_template' );
// Add comments back in if conditions are met
add_action( 'genesis_after_post', 'cd_conditional_comments' );
function cd_conditional_comments() {
// Conditional Reference http://codex.wordpress.org/Function_Reference/get_the_author
if ('Author Display Name' == get_the_author() ) {
genesis_get_comments_template();
@cdils
cdils / gist:4668290
Created January 29, 2013 21:54
If you've got the WP Types & Views plugin installed, you can use the following to clean up excess CSS and script files in the header.
// Get rid of WP-Views excess code in header
add_action( 'init', 'typeviews_cleanup' );
function typeviews_cleanup() {
if ( !is_admin() ) {
global $WP_Views;
remove_action('wp_print_styles', array($WP_Views, 'add_render_css'));
remove_action('wp_head', 'wpv_add_front_end_js');
wp_dequeue_style( 'views-pagination-style' );
@cdils
cdils / archive-testimonials-grid.php
Last active April 25, 2018 16:08 — forked from billerickson/grid-loop.php
Use this grid loop in a custom page template to show page content, followed by a loop through a custom post type.
<?php
/**
* Template Name: Testimonial Archives
* Description: Used as a page template to show page contents, followed by a loop through a CPT archive
*/
remove_action ('genesis_loop', 'genesis_do_loop'); // Remove the standard loop
add_action( 'genesis_loop', 'custom_do_grid_loop' ); // Add custom loop
@cdils
cdils / archive-testimonials.php
Last active April 17, 2023 20:13
This is code for a custom page template removing the standard Genesis loop and inserting a custom loop. Similar to https://gist.github.com/4684423.js, but without a grid loop.
<?php
/**
* Template Name: Testimonial Archives
* Description: Used as a page template to show page contents, followed by a loop through a CPT archive
*/
remove_action ('genesis_loop', 'genesis_do_loop'); // Remove the standard loop
add_action( 'genesis_loop', 'custom_do_loop' ); // Add custom loop
@cdils
cdils / sitemap.php
Created February 13, 2013 15:08
Partial sitemap file used in this tutorial: http://www.carriedils.com/custom-404-wordpress-html-sitemap/1574
<div class="archive-page">
<h2 id="pages">Pages</h2>
<ul>
<?php
// Add pages you'd like to exclude in the exclude here
wp_list_pages(
array(
'exclude' => '',
'title_li' => '',
)
@cdils
cdils / Custom_404_function.php
Last active December 13, 2015 17:08
Function to call in a custom 404 template for Genesis WordPress.
remove_action( 'genesis_loop', 'genesis_404' ); // Remove the default Genesis 404 content
add_action( 'genesis_loop', 'cd_custom_404' ); // Add function for custom 404 content
function cd_custom_404() {
if ( is_404() ) {
get_template_part('/partials/sitemap'); // Plop in our customized sitemap code
}
}
@cdils
cdils / search_shortcode.php
Last active March 29, 2018 22:06
This is a modified extract from Bill Erickson's Genesis 404 Page plugin (https://github.com/billerickson/Genesis-404-Page). This bit of code adds shortcode support for a search form within a Genesis page or post.
<?php
add_action( 'init', 'cd_register_shortcode' );
/**
* Register shortcode with the theme
*/
function cd_register_shortcode() {
add_shortcode( '404-search', 'cd_search_shortcode' );
}
@cdils
cdils / mp_functions.php
Last active December 13, 2015 22:58
For use on the Genesis Modern Portfolio child theme. Create a second widget area to mimic the homepage "About" widget on other pages in the site.
/** Register widget areas */
genesis_register_sidebar( array(
'id' => 'cta-1',
'name' => __( 'Call to Action', 'mp' ),
'description' => __( 'This is the call to action section.', 'mp' ),
) );
/** Add CTA widget support for site. If widget not active, don't display */