[Resolved] Disappearing hook on CPT category archive

Home Forums Support [Resolved] Disappearing hook on CPT category archive

Home Forums Support Disappearing hook on CPT category archive

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #680769
    Tyler

    I’m trying to get CPT categories to show up in the main query (which is now successful) but my hooks disappear>

    Here’s my markup:

       function generate_add_custom_types( $query ) {
         if( is_category() || is_tag() && $query->is_main_query())  {
           $query->set( 'post_type', array(
            'post', 'nav_menu_item', 'after_footer_widgets', 'manufacturers'
       		));
       	  return $query;
       	}
       }
       add_filter( 'pre_get_posts', 'generate_add_custom_types' );

    I added “nav_menu_item” which made the menu post type reappear. So I tried for my hook too but that doesn’t seem to do it since its not its own post type.

    How do I get GP hooks to show up again? πŸ™‚ Thanks!

    GeneratePress 2.1.4
    GP Premium 1.7.2
    #681309
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    You could try adding gp_elements to the array of post types to display?

    Let me know πŸ™‚

    #681515
    Tyler

    Hey Tom,

    Thanks!

    Partial success – that restored my “layout” elements. But my hooks are still not coming through.

    does the gp_elements post type contain hooks as well?

    #681789
    Tom
    Lead Developer
    Lead Developer

    Elements do have a “Hook” type. Is that what you’re using?

    #682404
    Tyler

    Yes, “hook” elements aren’t showing…or rather, my after_footer_widgets is not showing.

    adding “gp_elements” post type seemed to restore my “layout” elements (those weren’t showing before), but after_footer_widgets still isn’t appearing.

    I just tested another hook (before_header) and that is appearing…

    #682706
    Tom
    Lead Developer
    Lead Developer

    What happens if you switch that same problem hook to before_header? Does it show?

    #683303
    Tyler

    It doesn’t show there either, BUT plain text appears just fine. So the BB shortcode was the issue!

    I’m rendering a Beaver Builder shortcode in the footer hook hook site-wide that’s failing to appear on that CPT archive. The page is made with Themer and there isn’t any console error so I figured the BB post type was already showing.

    Added fl-builder-template to the function and voila. πŸ™‚ Thanks!

    #683454
    Tom
    Lead Developer
    Lead Developer

    Awesome! Glad you got it working πŸ™‚

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