Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #17016

    I’ve searched through other support tickets and can’t quite find the right answer for this…

    We would like to use the Choices Latest News widget in the footer twice – once for one category and once for another. When you click on any post now, the heading on the page is Blog – Latest News.

    I understand how to change that in the single.php file, but we really would like it to display the category name. For example, Latest Post: Good Links and Articles (that being the category name).

    And then for the other category, Latest Post: Catherine’s Blog

    Any help is most appreciated!

    Here is the site:

    http://motherhand.com/

    #93896

    Hey!

    In single.php replace:

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

    with:

    $cats  = get_the_category();
    $title = $cats[0]->cat_name;

    and the post category will be used as title.

    Best regards,

    Peter

    #93897

    Thanks Peter,

    I did this and it sort of worked…. But what is showing is the word Array instead of the category name!

    Any idea why?

    For example:

    http://motherhand.com/another-interesting-post/

    #93898

    Sorry – that post was removed without my knowing!

    http://motherhand.com/a-bit-of-crying-is-ok/

    #93899

    Hi!

    Whoops – the return value is an array in this case – I adjusted the code above.

    Best regards,

    Peter

    #93900

    Fantastic – thanks so much for your help! It works perfectly.

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Latest News widget’ is closed to new replies.