Forum Replies Created
-
AuthorReplies
-
Andre Goersch
ParticipantThat works perfectly. Thanks.
Another nice piece of information that would be great to have on the official docs. 🙂
Andre Goersch
ParticipantBingo, we have a winner. That works perfectly. I wasn’t really clear on what was the purpose of the $type parameter before, but now it makes sense.
Thanks very much Jason, you’ve been great help as always.
Andre Goersch
ParticipantThat gives the same result as using
is_page('franqueado')
, it changes the main loop to use that template part.Andre Goersch
ParticipantI found the function
is_main_query()
that might work here, but from the documentation it looks like I need to compare it to a query object… which I don’t have.Am I on the right path here?
Andre Goersch
ParticipantThat’s the part that is getting me. I tried something similar before, but if I just create a check like…
if ( is_page('franqueado') ) { $part = 'franquia-grid'; }
… what happens is that the entire loop for the page “franqueado” changes to my custom template, displaying the normal page content as a single element of the grid. I don’t know how to limit the change to the secondary loop the shortcode creates.
Andre Goersch
ParticipantI tried your code, but I’m having the same result, the actual archive pages work fine, but not that shortcode. Doesn’t the fact that I’m using the shortcode on a normal page requires different expressions?
Andre Goersch
ParticipantI see. So I kept the
add_theme_support
declaration in the beginning, and replaced the entire following function and filter for what you provided, and now it seems to be working correctly.Thank you so much for the assistance. As karlo pointed out, it would be great if you could update the docs with this sort of information, since it’s basically where I base all my work from.
Andre Goersch
ParticipantOh, I wasn’t aware of these changes. My current code is pretty much the same as featured on the documentation. Since I’m more a designer that writes some code than a developer, I usually stick to copy-pasting code as much as possible.
add_theme_support( 'post-formats', array( 'aside' ,'gallery' ,'link' ,'image' ,'quote' ,'video' ,'audio' ) ); // Use content-{post_format}.php for listing posts function my_template_parts( $parts ) { global $post; // Determine post format where relevant $post_format = ''; if( is_object($post) ) $post_format = get_post_format(); // Adjust template parts $parts['index'] = $post_format; $parts['list'] = $post_format; $parts['list_paginated'] = $post_format; $parts['list_slider'] = $post_format; $parts['single'] = $post_format; $parts['archive'] = $post_format; $parts['search_results'] = $post_format; return $parts; } add_filter( 'themeblvd_template_parts', 'my_template_parts' );
I’m reading the links you sent, and I’m not 100% positive on what I need to change. Do I just need to add
, $type
to the function declaration? Some of the code on those posts don’t really resemble mine so I’m not sure how I need to implement other changes.Thanks a lot for the help so far.
Andre Goersch
ParticipantOh, nevermind, I figured it out, I needed to add
$parts['search_results'] = $post_format;
to the $post_format array. I was trying ‘search’ before.
Andre Goersch
ParticipantAlright, that’s good to know. I’ll just stick with what I’ve been doing with my previous code base for those specific pages. Thanks for the advice on the element functions, those might help as well.
And thanks for making Jump Start, it really is helping me bring my work to the next level. Cheers!
-
AuthorReplies