Tagged: Latest News
-
AuthorPosts
-
January 4, 2014 at 11:38 pm #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 20What am I doing wrong?
ThanksJanuary 5, 2014 at 7:54 am #205506Hey 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,
IsmaelJanuary 5, 2014 at 10:40 pm #205692Hi 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.
January 6, 2014 at 9:49 pm #205978Hi Ismael,
What I need to do is exactly the same as this forum post http://bit.ly/1aBzOi6I 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
January 7, 2014 at 8:32 am #206190Hi!
Edit single.php, remove everything then replace it with this code: http://pastebin.com/Vzc73sCc
Best regards,
IsmaelJanuary 8, 2014 at 3:07 am #206597Hi 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, 10 months ago by akmhou.
January 8, 2014 at 6:29 am #206649Hi!
Please don’t specify a blog page on “Where do you want to display blog?” option. Leave it blank.
Best regards,
IsmaelJanuary 8, 2014 at 4:00 pm #206852Worked like a charm!
Ismael, thanks a lot for your help and working with me through this process.
You can mark the issue as resolved. -
AuthorPosts
- The topic ‘Latest News Headline’ is closed to new replies.