Site logo

[Support request] Targetting GP element to display on child pages of a parent page

Home Forums Support [Support request] Targetting GP element to display on child pages of a parent page

Home Forums Support Targetting GP element to display on child pages of a parent page

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2560498
    Ben

    Hi,
    I have an element (javascript that hooks into wp_head) that I need to only appear on all child pages of a particular parent page.

    Is there a way to set this display rule for GP elements?

    Many thanks
    Ben

    #2560524
    Leo
    Staff
    Customer Support

    Hi Ben,

    I believe the generate_element_display filter is what you are looking for.

    Take a look at the second example here:
    https://docs.generatepress.com/article/generate_element_display/

    Let me know if this helps 🙂

    #2560596
    Ben

    thanks Leo,
    Does that go in functions.php ?

    #2560717
    Ying
    Staff
    Customer Support

    Hi Ben,

    You can use one of the methods introduced in the below article:
    https://docs.generatepress.com/article/adding-php/

    If you are using a child theme, you can add the PHP code to the child theme’s functions.php file.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.