Home › Forums › Support › Conditional Hook This topic has 3 replies, 2 voices, and was last updated 4 years, 8 months ago by Leo. Viewing 4 posts - 1 through 4 (of 4 total) Author Posts July 11, 2019 at 10:20 am #955141 Dan HI Any idea why this is not working? (located in functions.php) if ( is_single() ){ add_action( 'generate_after_main_content','ds_recent_articles' ); function ds_recent_articles() { echo do_shortcode('[wp_show_posts id="422"]'); } } Without the condition it works, but then displays the posts on all pages. Thanks Dan July 11, 2019 at 10:27 am #955146 LeoStaff Customer Support Hi there, First of all just want to make sure you are referring to child theme’s function.php. The code isn’t working as the conditional tag needs to be inside the function itself like this: https://generatepress.com/forums/topic/modify-image-size-name-on-single-php/#post-944686 That can also be done using our hooks element as well without any coding: https://docs.generatepress.com/article/hooks-element-overview/ July 11, 2019 at 11:48 am #955228 Dan Thanks Leo. Moving the conditional into the function fixed the issue. This site specifically doesn’t have GP premium, so a hook inside functions.php had to do. Thanks again for your great support, much appreciated. Dan July 11, 2019 at 1:06 pm #955310 LeoStaff Customer Support No problem 🙂 Author Posts Viewing 4 posts - 1 through 4 (of 4 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In