Skip to content

Instantly share code, notes, and snippets.

@vfontjr
Created April 29, 2020 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vfontjr/31f86f45c913ba178b757631af7bc46d to your computer and use it in GitHub Desktop.
Save vfontjr/31f86f45c913ba178b757631af7bc46d to your computer and use it in GitHub Desktop.
<?php
/**
* This file adds the custom portfolio post type archive template to the Executive Pro Theme.
*
* @author StudioPress
* @package Executive Pro
* @subpackage Customizations
*/
//* Force full width content layout
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
//* Remove the breadcrumb navigation
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
//* Remove the post info function
remove_action( 'genesis_entry_header', 'genesis_post_info', 5 );
//* Remove the post content
remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
//* Remove the post image
remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
//* Add portfolio body class to the head
add_filter( 'body_class', 'executive_add_portfolio_body_class' );
function executive_add_portfolio_body_class( $classes ) {
$classes[] = 'executive-pro-portfolio';
return $classes;
}
//* Add the featured image after post title
add_action( 'genesis_entry_header', 'executive_portfolio_grid' );
function executive_portfolio_grid() {
if ( $image = genesis_get_image( 'format=url&size=portfolio' ) ) {
printf( '<div class="portfolio-featured-image"><a href="%s" rel="bookmark"><img src="%s" alt="%s" /></a></div>', get_permalink(), $image, the_title_attribute( 'echo=0' ) );
}
}
//* Remove the post meta function
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
genesis();
<?php
function remove_genesis_actions_for_portfolio_archive() {
$actions_to_remove = array(
'genesis_before_loop' => array(
'function_to_remove' => 'genesis_do_breadcrumbs',
),
'genesis_entry_header' => array(
'function_to_remove' => 'genesis_post_info',
'priority' => 5,
),
'genesis_entry_content' => array(
'function_to_remove' => 'genesis_do_post_content',
),
'genesis_entry_content' => array(
'function_to_remove' => 'genesis_do_post_image',
'priority' => 8,
),
'genesis_entry_footer' => array(
'function_to_remove' => 'genesis_post_meta',
),
);
foreach ( $actions_to_remove as $tag => $args ) {
$priority = array_key_exists( 'priority', $args ) ? $args['priority'] : 10;
remove_action( $tag, $args['function_to_remove'], $priority );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment