- This topic has 4 replies, 3 voices, and was last updated 3 years, 7 months ago by Tom.
-
AuthorPosts
-
September 19, 2020 at 4:27 am #1449722Matthew
Hi,
I may have missed post on this already but didn’t see one in the search.
I have a CPT (wpfc_sermon) generated by a third-party module (Sermon Manager – https://en-gb.wordpress.org/plugins/sermon-manager-for-wordpress/).
I have managed to integrate it into GP using module provided filters and GP provided filters so that it displays Archive and Single as a GP Archive & Single. However, I cannot get a sidebar to display on Archive page or Single posts, and I’m not sure why.
Sidebars work on normal posts, just not on this CPT.
The code for integration is below, do you see anything obvious.
add_filter( 'generate_blog_columns', function ( $columns ) { if ( is_post_type_archive( 'wpfc_sermon' ) ) { return true; } return $columns; }); add_filter( 'generate_sidebar_layout', function( $layout ) { // If we are viewing search results, set the sidebar if ( is_post_type_archive( 'wpfc_sermon' ) || is_page_template( 'content-sermon-single.php' ) || get_post_type() ==='wpfc_sermon' ) { return 'right-sidebar'; } // Or else, set the regular layout return $layout; } ); add_filter( 'sm_templates_wrapper_start' , function ($content) { ob_start(); ?> <div id="primary" <?php generate_do_element_classes( 'content' ); ?>> <main id="main" <?php generate_do_element_classes( 'main' ); ?>> <?php do_action( 'generate_before_main_content' ); return ob_get_clean(); }); add_filter( 'sm_templates_wrapper_end' , function ($content) { ob_start(); do_action( 'generate_after_main_content' ); ?> </main><!-- #main --> </div> <?php do_action( 'generate_after_primary_content_area' ); generate_construct_sidebars(); return ob_get_clean(); });
September 19, 2020 at 4:29 am #1449724MatthewSorry, forgot to add the generate_get_layout() does return ‘right-sidebar’ for the CPT.
September 19, 2020 at 9:25 am #1450108LeoStaffCustomer SupportHi there,
Any chance you can link us to the site in question?
You can use the private information field.
Let me know 🙂
September 21, 2020 at 1:32 am #1451793MatthewI have attached those details.
Just as an update if I removed the filters that wrap the CPT in GP container then the sidebar shows.
September 21, 2020 at 10:40 am #1452664TomLead DeveloperLead DeveloperHi there,
Are you sure the template hooks are filters (add_filter) and not actions (add_action)? Do they have instructions on integrating themes with their plugin that we can check out?
-
AuthorPosts
- You must be logged in to reply to this topic.