Archived topic
Using Child Theme with different blog layouts
11 replies · Started by Heinrich on March 1, 2019
Hi Tom!
Thanks for your great work!
I have GP PRO installed and additonally implemented a child theme of it.
I want to have the GP for the site and the child theme ONLY on one special category.
I solved this with the plugin multiple themeBUT how can I seperately change the blog layout options.
Generally I want to have the blog layout content type = "excerpt" and only wihtin this one special category for which I'm using the child theme I want to use the content type = "full".
THX for your help!
Martin
Hey Martin,
You could try this function inside the child theme functions.php file:
add_filter( 'generate_show_excerpt', '__return_false' );
Let me know :)
Hi Tom!
Thx for your awsome quick answering!
It is working!
I additionally added the filter for only one special category:
add_filter( 'generate_show_excerpt','tu_full_post_harvest' );
function tu_full_post_harvest( $show_excerpt )
{
if ( is_category( 'toprint' ) )
return false;
return $show_excerpt;
}
Additional Question:
And how can I show the full post in the category view even if the user has insterted a "read more" tag?
BR
Martin
Try this:
add_filter( 'generate_more_tag', '__return_empty_string' );
Hi Tom,
it's not working!
Have a look https://schulungen.badhaering.at/category/toprint/
It's german "weiterlesen" in the first post "full post test"
I gave the snippet in the functions.php as well as the others.
BR
Martin
That's strange, it should work. Maybe try this:
add_filter( 'generate_more_tag', '__return_false' );
Hi,
no it didn't help!
As I mentioned - it is a <!--more--> tag in the content.
There is no cache plugin!
BR
Martin
Hmm, both the functions should prevent the more tag from affecting the excerpts. I wonder if you have some conflicting code.. What happens if you temporarily remove your other functions and keep the one here?: https://generatepress.com/forums/topic/using-child-theme-with-different-blog-layouts/#post-827020
Hi,
it's so strange!
At the moment my functions.php:
function child_theme_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-theme-css', get_stylesheet_directory_uri() .'/style.css' , array('parent-style'));
}
add_action( 'wp_enqueue_scripts', 'child_theme_styles' );
add_filter( 'generate_more_tag', '__return_false' );
add_filter( 'generate_show_excerpt', '__return_false' );
If I'm removing add_filter( 'generate_show_excerpt', '__return_false' );` then the read more AND the rest of the content won't be visible.
And the read more (from excerpt) will apear in the other posts again.
I additionally have installed the GP Premium PlugIn but it won't help.
BR
Martin
Ah, I misunderstood the question - sorry!
The more tag is dealt with by WordPress in the function that outputs the content. I just dug into some of the code and I couldn't find a way to disable it using a filter, unfortunately.
okay, thank you for your troubles!
No problem! Sorry I couldn't be more helpful.