Custom template part file for Grid Shortcode
-
Topic
-
The title should be pretty self-explanatory, but I have a custom post type for which I use a custom template part file to display different information with each post. It works fine following the JumpStart’s documentation for both the custom post type and a related taxonomy’s archives, except that the “initial” page I use to display the list of posts uses a Post Grid shortcode (since my client wants to have control over some additional content displayed above the grid).
I can setup the shortcode without problems to display posts from that custom post type, except that it is not using the template part I setup. Here is the code I’m using to change the template files:
function my_template_parts( $parts ) { if ( is_post_type_archive('franquia') ) { $parts['archive'] = 'franquia-grid'; } if ( is_tax( 'praca_interesse' ) ) { $parts['archive'] = 'franquia-grid'; } return $parts; } add_filter( 'themeblvd_template_parts', 'my_template_parts' ); /** * Manually trigger grid mode. */ function my_theme_mode_override( $mode ) { if( is_post_type_archive('franquia') || is_tax( 'praca_interesse' ) ) { $mode = 'grid'; } return $mode; } add_filter( 'themeblvd_theme_mode_override', 'my_theme_mode_override' );
Here is the page I want to change the grid format: http://bastockler.com.br/wordpress/franqueado/
And this is the archive for the same custom post type: http://bastockler.com.br/wordpress/franquia/
The different isn’t that big, but I needed all images to have links automatically, and instead of a “Read More” button, I need that button that opens a modal form.
Is there an easy way to accomplish this, or do I need to make a complete new template with a custom WP_Query?
Thanks
- You must be logged in to reply to this topic.