Skip to content

Instantly share code, notes, and snippets.

View braddalton's full-sized avatar

Brad Dalton braddalton

View GitHub Profile
<?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 October 14, 2020 13:58
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/
remove_action( 'genesis_after_endwhile', 'genesis_posts_nav' );
<?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 December 14, 2015 07:08
Add Home Page Widget Area For Slider Using The Prose Child Theme
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/
*/
<?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 February 28, 2013 18:19
Remove the posts meta like tagged with and filed under on the home page or front 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 February 28, 2013 22:18
Adds a full width widget area to the home page of Genesis child themes.
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 March 1, 2013 02:14
This code removes the post meta on all pages including all archives
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 December 14, 2015 08:59
Removes all the post meta from displaying on single posts but not archive pages.
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 March 1, 2013 02:20
This code removes the post meta from displaying on the 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' );
}