Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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,
    Gabe

    #423260

    Hi 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!
    Elliott

    #423466
    This reply has been marked as private.
    #424070

    Hi!

    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, 8 months ago by Elliott.
    #1032675

    Hi, 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!

    #1034001

    Hi dannhanks,

    Can you give us a link to the page that shows the issue? so we can check further.

    Best regards,
    Nikko

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.