Archived topic
Disappearing hook on CPT category archive
7 replies · Started by Tyler on September 18, 2018
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!
Hi there,
You could try adding gp_elements to the array of post types to display?
Let me know :)
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?
Elements do have a "Hook" type. Is that what you're using?
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...
What happens if you switch that same problem hook to before_header? Does it show?
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!
Awesome! Glad you got it working :)