-
AuthorPosts
-
April 2, 2015 at 10:09 pm #422800
Hi,
I would like the page title within blog posts automatically be the name of whatever parent category the post resides in. Is this possible?
Thanks,
GabeApril 3, 2015 at 8:34 pm #423260Hi connect4consulting!
Add this to the bottom of your functions.php file.
function avia_default_title_filter($current_post) { if(!empty($current_post['title'])) { $heading = is_singular() ? "h1" : "h2"; $cat = get_the_category($current_post['the_id']); $output = ""; //$output .= "<{$heading} class='post-title entry-title ". avia_offset_class('meta', false). "'>"; $output .= "<{$heading} class='post-title entry-title' ".avia_markup_helper(array('context' => 'entry_title','echo'=>false)).">"; $output .= " <a href='".get_permalink()."' rel='bookmark' title='". __('Permanent Link:','avia_framework')." ".$current_post['title']."'>".$cat[0]->cat_name; $output .= " <span class='post-format-icon minor-meta'></span>"; $output .= " </a>"; $output .= "</{$heading}>"; $current_post['title'] = $output; } return $current_post; }
Cheers!
ElliottApril 4, 2015 at 5:17 pm #423466This reply has been marked as private.April 6, 2015 at 6:00 pm #424070Hi!
If your viewing a category in the archives then it should already be displaying the category as the title, http://kriesi.at/themes/enfold/category/science/.
Send us a link and take a screenshot highlighting what your trying to do so we can get a better idea.
Best regards,
Elliott- This reply was modified 9 years, 7 months ago by Elliott.
November 12, 2018 at 5:57 pm #1032675Hi, I am having this issue too.
I have a ‘news’ page, a ‘blog’ page and an ‘articles and publications’ page. Each has a blog element displaying the category ‘news’ ‘blog’ or ‘articles and publications’.When on the page, the page title is shown as:
<h1 class="main-title entry-title"><a href="#" rel="bookmark" title="Permanent Link: Publications" itemprop="headline">Publications</a></h1>
(the one in the header with the breadcrumbs).
This is correct, when you then read a post from this category, the page title changes to ‘Blog – Latest News’
I would like this to show the category name.
thanks!
November 15, 2018 at 3:33 pm #1034001Hi dannhanks,
Can you give us a link to the page that shows the issue? so we can check further.
Best regards,
Nikko -
AuthorPosts
- You must be logged in to reply to this topic.