Tagged: 

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #205444

    Hi,
    I’m using the Latest News widget in my footer. I would like to change the headline of single page post from “blog” to Latest News or the category name. How can I do that?

    I read the Josue’s instructions from his answer to the post here http://bit.ly/1dkV3FD.
    I edited line #20 in single.php to this:
    `if( get_post_meta(get_the_ID(), ‘header’, true) != ‘no’) echo avia_title(array(‘heading’=>’strong’, ‘title’ => get_the_category()[0]->cat_name, ‘link’ => $t_link, ‘subtitle’ => $t_sub));

    I’m getting an error:
    Parse error: syntax error, unexpected ‘[‘, expecting ‘)’ in /home4/akmimrp/public_html/stagingarea/2013212/wp-content/themes/enfold-child/single.php on line 20

    What am I doing wrong?
    Thanks

    #205506

    Hey akmhou!

    Add this on functions.php file:

    add_filter('avf_title_args', 'fix_single_post_title', 10, 2);
    function fix_single_post_title($args,$id)
    {
    if (is_single())
    {
    $args['title'] = "Latest News";
    $args['link'] = get_permalink($id);
    }
    
    return $args;
    }

    Best regards,
    Ismael

    #205692

    Hi Ismael,

    Thanks a lot for the code for my functions.php. It worked exactly as it should. It changed the title of the single post page from Blog to Latest News.

    My fault for not explaining what I was after. Here’s what I would like to happen:

    In the footer, I’m using the Latest News widget, when I click on a news item, I would like the headline of the single page to say “Latest News.” However, I don’t want the headline to change from “Blog” on the single post page where there are posts that are not categorized as News.

    How can I duplicate single.php such that one pulls posts from “News” category only and have a title of “Latest News” and another one that pulls all posts from other categories and will have a title of “Blog?”
    Is there a better way to do what I am after?

    Thanks.

    #205978

    Hi Ismael,
    What I need to do is exactly the same as this forum post http://bit.ly/1aBzOi6

    I understood the first part of your reply about Enfold > Theme Options >. Could you please provide some details about the second part of your answer where you said, “Edit the blog page then configure the category option?”

    Thanks

    #206190

    Hi!

    Edit single.php, remove everything then replace it with this code: http://pastebin.com/Vzc73sCc

    Best regards,
    Ismael

    #206597

    Hi Ismael,

    Your code worked perfectly. Thanks. I’m almost there but still missing something.
    This is what I have done so far.
    • Create two new pages – News and Blog Center.
    • Selected my blog sidebar etc.
    • Added “Blog Posts” content element to each page
    • Selected a specific category for each page.
    • Selected the new blog page under Theme Options
    I have added your new code to single.php
    The single post page is pulling the category name correctly in the title. However, the archive pages for both still show all posts and not just the posts from the respective categories.

    How can I exclude categories from each of the blog archive pages and show only posts from a particular category?

    Thanks for your help.

    • This reply was modified 10 years, 11 months ago by akmhou.
    #206649

    Hi!

    Please don’t specify a blog page on “Where do you want to display blog?” option. Leave it blank.

    Best regards,
    Ismael

    #206852

    Worked like a charm!
    Ismael, thanks a lot for your help and working with me through this process.
    You can mark the issue as resolved.

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Latest News Headline’ is closed to new replies.