Skip to content

Instantly share code, notes, and snippets.

Avatar

Brad Dalton braddalton

View GitHub Profile
View genesis-custom-loop-pagination.php
<?php
/* Template Name: Test */
/**
* Genesis custom loop
*/
function be_custom_loop() {
global $post;
// arguments, adjust as needed
@braddalton
braddalton / Remove Page Navigation Genesis
Last active Oct 14, 2020
Remove Pagination Genesis. This PHP code removes the page naviagtion from all archives Source http://wpsites.net/web-design/genesis-remove-page-navigation-pagination-from-any-archive-page/
View Remove Page Navigation Genesis
remove_action( 'genesis_after_endwhile', 'genesis_posts_nav' );
View embed-gist.php
<?php
/**
* Usage:
* Paste a gist link into a blog post or page and it will be embedded eg:
* https://gist.github.com/2926827
*
* If a gist has multiple files you can select one using a url in the following format:
* https://gist.github.com/2926827?file=embed-gist.php
*/
@braddalton
braddalton / Home Page Widget
Last active Dec 14, 2015
Add Home Page Widget Area For Slider Using The Prose Child Theme
View Home Page Widget
genesis_register_sidebar( array(
'id' => 'home-slider',
'name' => __( 'Home Slider', 'prose' ),
'description' => __( 'This is the slider section of the homepage.', 'prose' ),
) );
/**
* @author Brad Dalton - WP Sites
* @link http://wpsites.net/web-design/home-page-slider-prose-theme/
*/
View conditional-actions.php
<?php
add_action( 'genesis_before', 'child_conditional_actions' );
function child_conditional_actions() {
if( /**insert your conditional statements here */ ) {
//put your actions here
}
//you could add additional conditional statements as needed here
@braddalton
braddalton / Remove Post Meta Home Page
Created Feb 28, 2013
Remove the posts meta like tagged with and filed under on the home page or front page.
View Remove Post Meta Home Page
add_action( ‘genesis_before’, ‘remove_post_meta_home_page’ );
function remove_post_meta_home_page() {
if( is_home() || is_front_page() ) {
remove_action( ‘genesis_after_post_content’, ‘genesis_post_meta’ );
}}
@braddalton
braddalton / Home Page Full Width Widget
Created Feb 28, 2013
Adds a full width widget area to the home page of Genesis child themes.
View Home Page Full Width Widget
genesis_register_sidebar( array(
'id' => 'home-custom',
'name' => __( 'Home Slider', 'magazine' ),
'description' => __( 'This is the slider widget area for your homepage.', 'magazine' ),
) );
add_action( 'genesis_before_content_sidebar_wrap', 'child_before_content');
function child_before_content() {
if ( is_home() ) {
echo '<div id="home-custom">';
@braddalton
braddalton / Remove Post Meta Pages
Created Mar 1, 2013
This code removes the post meta on all pages including all archives
View Remove Post Meta Pages
add_filter( 'genesis_post_meta', 'remove_post_meta_pages' );
function remove_post_meta_pages( $post_meta ) {
if ( !is_page() ) {
$post_meta = '[post_categories before="' . __( 'Filed Under: ', 'minimum' ) . '"] // [post_tags before="' . __( 'Tagged: ', 'minimum' ) . '"]';
return $post_meta;
}}
@braddalton
braddalton / Remove Post Meta Single Posts
Last active Dec 14, 2015
Removes all the post meta from displaying on single posts but not archive pages.
View Remove Post Meta Single Posts
add_filter( 'genesis_post_meta', 'remove_post_meta_single_posts' );
function remove_post_meta_single_posts( $post_meta ) {
if ( is_single() ) {
$post_meta = '[post_categories before="' . __( 'Filed Under: ', 'minimum' ) . '"] // [post_tags before="' . __( 'Tagged: ', 'minimum' ) . '"]';
return $post_meta;
}}
@braddalton
braddalton / Remove Post Meta Home Page
Created Mar 1, 2013
This code removes the post meta from displaying on the home page
View Remove Post Meta Home Page
add_action ( 'genesis_post_content' , 'remove_post_meta_home' );
function remove_post_meta_home() {
global $post;
if ( is_home () )
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
}