Tagged: blog element, enfold
Hello guys!
The problem I’m having is that I have three separate pages each with it’s own Blog Element, pulling in various separate categories.
e.g. the ‘News’ page Blog Element pulls in around 10 different categories, whilst the other 2 pages (‘Knowledge Base’ + ‘Case Studies’) pull in their own discreet categories.
When you click into any of the posts, they all display ‘Blog – Latest News’. I want them to display News, Knowledge Base and Case Studies on each of their respective pages/sections.
All of the instructions I’ve read on this forum so far only instruct the user to edit single.php /index.php and edit the ‘Blog – Latest News’ text (or delete it) – which is only a once-off approach and doesn’t deal with a multiple blog instance.
I’ve tried setting ‘News’ as the Blog Page in Enfold settings, but that pulls in every category, whether or not I create a Blog Element on the News page and discreetly select the categories I want to display.
I hope I’m missing something obvious here and you can point me in the right direction, otherwise can you send me some code to put into single.php that will display the correct page title for the Blog Element associated with it.
PS – well done so far on a great framework… it’s shaping up into something quite special.
Regards.
Hi jeeves,
Add following code to the bottom of functions.php:
add_filter('avf_title_args', 'fix_single_post_title', 10, 2);
function fix_single_post_title($args,$id)
{
if ( $args['title'] == 'Blog - Latest News' )
{
$args['title'] = get_the_title($id);
$args['link'] = get_permalink($id);
}
return $args;
}
This will replace the “Blog – Latest News” with the page title.
Regards,
Devin
Hi Devin,
Thanks for the solution. It’s not a bad solution in that it now gives me the repeated title of the single post instead of the ‘section’ title e.g. News, Knowledge Base or Case Studies. For now though, it’s better than the catch-all ‘Blog – Latest News’.
If you were able to improve on this I’d be most happy!
Best wishes…