Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #240255

    Hi Guys,
    In Flagship I have a 4 x Dynamic Page templates, each set to display a blog element displaying posts from a specific category.
    (I have also selected these dynamic templates in four separate pages, which are in the menu structure).
    The problem is that when we click on a post – the Page Title is defaulting to “Blog – Latest News”. Of Course I can go into single.php and amend this, but I want the title to display the category that the post belongs to.
    I could’ve used a catch-all title to get around this – e.g. “Case Studies”, but unfortunately the edit to single.php also interferes with my ‘News’ section. (I tried 2 ways of setting this part up – one by making a dynamic template called ‘News’ and attaching it to a page called ‘News’ – the second by selecting the ‘News’ page in the Flagship theme settings under “And where do you want to display the Blog?”).
    I’ve seen a similar solution given as a function for the Enfold theme, so I’m hoping you can give me something similar that will do the trick for Flagship!
    [Sidenote – I upgraded to WP3.8.1 with this theme and all seems to be working perfectly.] ;)


    Hi jeeves!

    Please edit the single.php, find this code on line 27:

    $title  = __('Blog - Latest News', 'avia_framework'); //default blog title

    Add this code below:

    if(is_single()) {
    					$category = get_the_category(); 
    					$title = $category[0]->cat_name;
    					} else {
    					$title  = __('Blog - Latest News', 'avia_framework'); //default blog title

    This will render the first category of the post.


    This reply has been marked as private.
Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Display Category title on Single Posts’ is closed to new replies.