[Resolved] Feature request: Allow php in Sections

Home Forums Support Feature request: Allow php in Sections

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1050374
    Pete

    I’d like to see php be able to be applied inside Sections indirectly via a GP Hook or directly in the content of the Section.

    #1050430
    David
    Staff
    Customer Support

    Hi there,

    this topic explains how to create a Shortcode that will output your own custom hook:

    https://generatepress.com/forums/topic/hook/#post-1036765

    Then you can add the shortcode where you want and use the Custom Hook option in the Hook Element.

    #1051064
    Pete

    I’d like something easy like in Hooks as some of my php is long and complex.

    #1051263
    David
    Staff
    Customer Support

    Hooks are a WP function that do not and cannot exist within the_content of your posts, whether that be the classic WP editor or GP Sections. The method i provided above is the only way of adding a hook to the content. Once the shortcode is setup then you can use GP Hook Element or write your own add_action function to hook in your code.

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