• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

struggling with organizing some code

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › struggling with organizing some code

This topic is: not resolved
  • This topic has 2 replies, 2 voices, and was last updated 10 years, 10 months ago by mmjaeger.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • June 26, 2015 at 7:21 am #157574
    mmjaeger
    Member

    Hello
    I'm loading a conditional template in the functions.php file like:

    add_filter( 'template_include', 'be_blog_grid' );
    function be_blog_grid( $template ) {
      
    	if ( is_home() && ! is_admin() && isset( $_GET['view'] ) )
        	$template = locate_template( array('templates/file.php' ) );
       
      	return $template;
      
    }
    

    I believe that part works just fine.

    In the template file I've the following code - it's supposed to show the post gallery:

    add_action( 'genesis_after_entry_content', 'theme_add_gallery_after_entry_content' );
    function theme_add_gallery_after_entry_content() {
    	echo do_shortcode( "[gallery id='".get_the_ID()."']" );
    	$test = do_shortcode( '[gallery id="' . get_the_ID() . '" columns="3" size="thumbnail"]' );
    	var_dump($test);
    }
    

    It's not returning anything - what am I missing?

    In this regard I also have another question - in that template file, I'd like to conditionally process some other Genesis actions like: add_action( 'genesis_before_loop', 'genesis_do_post_title' ); for instance - depending on some url parameter - how would I setup those conditionals in the template file.

    Hope somebody can help.

    Thanks

    June 26, 2015 at 9:03 am #157577
    Genesis Developer
    Member

    If you are using HTML5 then genesis_after_entry_content will not work. It will be genesis_entry_content


    Download Genesis Featured Posts Combo Widget | Simple Grid Layouts Plugin for Posts, CPTs and terms
    You can request new tips/help.

    June 26, 2015 at 9:13 am #157581
    mmjaeger
    Member

    Thanks for replying

    quick question - let's say I've something like this in the url: ?view=xyz

    how can I e.g. conditionally remove the post_thumbnail in that template file?

    would this be the recommended way to do it:

    
    remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
    add_action('genesis_entry_content', 'theme_do_post_image')

    ;
    if ( isset( $_GET[ 'view' ] ) && $_GET[ 'view' ] == 'xyz') {
    remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
    } else {

    add_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
    }`

    could this also be grouped together somehow if I have several add_action depending on the condition?

    Thanks again

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble