[Resolved] Hook not displaying properly on custom post type

Home Forums Support [Resolved] Hook not displaying properly on custom post type

Home Forums Support Hook not displaying properly on custom post type

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2178980
    Kevin

    I’ve created a custom post type with a content template that pulls in the title, featured image, and content dynamically. For this custom post type, I’ve created a custom hook for social media sharing buttons. In most parts of the custom post type, I’m able to display these social buttons with no issues and predictably. However, when I try to use the hooks to generate after entry title, before entry content, etc. It will not display where it should.

    If I change the hook location to just regular posts it displays exactly where it should. Is there an extra step I’m supposed to take to get it to display after my title with custom post types? The hook works and displays perfectly otherwise, I just cant get it to display after my title, or before my content.

    Here is a link to the custom post type in question and the social media sharing buttons displaying properly at the bottom of the page (generate_after_do_template_part)

    Hook Issue

    #2178989
    Ying
    Staff
    Customer Support

    However, when I try to use the hooks to generate after entry title, before entry content, etc. It will not display where it should.

    When you say you are using a content template for the CPT, do you mean a block element – content template?

    If so, there will be NO more entry title/entry content in your CPT as they’re not defined in the content template.

    #2178993
    Kevin

    Ah, I do mean a block element – content template so that explains why it won’t display on that custom post type. Is there a way to do a custom hook that would make it display before the content in this custom post type?

    I love how lightweight this hook is and I’d love to have these buttons display above the content.

    #2179002
    Ying
    Staff
    Customer Support

    Is it possible to turn your current PHP code into a shortcode?

    Then you can add the shortcode using a shortcode block to the block element.

    #2179003
    Kevin

    Fantastic thought, thank you, Ying!

    #2179010
    Ying
    Staff
    Customer Support

    No problem 🙂

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