• 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

No Sidebar – Insert code in genesis_entry_content

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 › No Sidebar – Insert code in genesis_entry_content

This topic is: not resolved

Tagged: ACF, genesis_entry_content

  • This topic has 1 reply, 2 voices, and was last updated 3 years, 3 months ago by Brad Dalton.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • May 10, 2019 at 6:35 pm #491089
    Nigel1985
    Participant

    Hello, having an issue adding code to my single.php template. What function would you use to add the following code with the genesis_entry_content hook?

    Many thanks!

    <?php if ( get_field( 'use' ) == 1 ) { 
     // echo 'true'; 
    } else { 
     // echo 'false'; 
    } ?>
    
    <?php if ( have_rows( 'images' ) ) : ?>
    	<?php while ( have_rows( 'images' ) ) : the_row(); ?>
    		<?php $image = get_sub_field( 'image' ); ?>
    		<?php if ( $image ) { ?>
    			<div class="<?php echo the_sub_field( 'position' ); ?>"><img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" /></div>
    		<?php } ?>
    	<?php endwhile; ?>
    <?php else : ?>
    	<?php // no rows found ?>
    <?php endif; ?>
    
    <?php the_field( 'recipe_tip' ); ?>
    <?php the_field( 'sponsored_content' ); ?>
    
    <?php gravity_form(2, true, true, true, '', true, 1);?>
    <?php echo do_shortcode ('[shareaholic app="share_buttons" id_name="post_below_content"]'); ?>
    https://www.add1tbsp.com/recipes/chewy-coconut-cherry-oatmeal-cookies/
    May 11, 2019 at 10:09 am #491112
    Brad Dalton
    Participant

    Try removing the PHP tags and wrapping the code in a hook like this :

    add_action( 'genesis_entry_content', 'your_function_name' );
    function your_function_name() {
    
    // Add your code here
    
    }
    

    Recent Client work

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 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

© 2022 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