• 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

Placing Shortcode into genesis_after_post_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 › General Genesis Framework Discussions › Placing Shortcode into genesis_after_post_content

This topic is: resolved

Tagged: do_shortcode, is_singular

  • This topic has 2 replies, 2 voices, and was last updated 7 months, 3 weeks ago by gucu.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • October 10, 2022 at 8:52 am #505972
    gucu
    Participant

    Hi

    I hope someone can help. I am wanting to add the shortcode below on every page in the site. I have started to add it to each page and maybe that will be the best way forward but with over 1000 pages it will take a long time. Is it possible to place the shortcode in the functions.php file and get it to action when there is a page to display?

        add_action('genesis_after_post_content', 'shortcode_wp_pagelist');
        function shortcode_wp_pagelist() {
        if ( is_single() ) {
            echo do_shortcode('[pagelist sort_column="post_date" child_of="parent" class="page-list-cols-3"]');
           }
        }

    Thanks

    Rich

    https://gucu.me.uk/the-bible/the-old-testament/isaiah/isaiah-34/
    October 10, 2022 at 10:07 am #505974
    Brad Dalton
    Participant

    2 things to check :

    1. Use the correct HTML 5 Hook assuming your theme supports HTML 5.

    2. The correct conditional tag for single posts is

    is_singular('post')

    or for single pages

    is_singular('page')

    Tutorials for StudioPress Themes & WooCommerce.

    October 10, 2022 at 10:18 am #505975
    gucu
    Participant

    Thanks Brad. That worked perfectly.

    Rich

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Log In

CTA

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

Create a site with WP EngineShop for Themes

Footer

StudioPress

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