-
AuthorPosts
-
July 18, 2016 at 5:52 pm #662168
Hi,
I am currently using this code to replace the default post tile “Blog – Latest News” with the actual post title, works great, how can add the post published date to that now?
/* *Replace the default “Blog – Latest News” title *http://kriesi.at/documentation/enfold/replace-the-default-blog-latest-news-title/ */ add_filter('avf_title_args', 'fix_single_post_title', 10, 2); function fix_single_post_title($args,$id) { if ( $args['title'] == 'Blog - Latest News' ) { $args['title'] = get_the_title($id); $args['link'] = get_permalink($id); $args['heading'] = 'h1'; } return $args;
- This topic was modified 8 years, 5 months ago by yingyang.
July 18, 2016 at 6:01 pm #662175Hey kilimats!
Please use the code as following
add_filter('avf_title_args', 'fix_single_post_title', 10, 2); function fix_single_post_title($args,$id) { $my_date = the_date('', '<span>', '</span>', FALSE); if ( $args['title'] == 'Blog - Latest News' ) { $args['title'] = get_the_title($id) .' - '. $my_date; $args['link'] = get_permalink($id); $args['heading'] = 'h1'; } return $args; }
Best regards,
YigitJuly 18, 2016 at 8:45 pm #662263Beauty ! worked, how can i add a few words before like POST FOR then date and post title after?
July 18, 2016 at 11:35 pm #662293Hey!
Please change the code to following one
add_filter('avf_title_args', 'fix_single_post_title', 10, 2); function fix_single_post_title($args,$id) { $my_date = the_date('', '<span>', '</span>', FALSE); if ( $args['title'] == 'Blog - Latest News' ) { $args['title'] = '<strong>POST FOR: </strong>'. $my_date .' - ' .get_the_title($id); $args['link'] = get_permalink($id); $args['heading'] = 'h1'; } return $args; }
Regards,
YigitJuly 18, 2016 at 11:41 pm #662296nice im learning thanks ! now if i wanted to make the post title STRONG, how would i format that, tried
<strong>.get_the_title($id)</strong>
but the site crashedlast question promise
edit: noticed a bug,the google chrome tab doesnt display properly, on the private link below, the tab shows “- 0” but the post title is – $350 – (POSTED ON: JULY 5, 2016)
- This reply was modified 8 years, 5 months ago by yingyang.
July 19, 2016 at 1:33 pm #662464Hi,
Try this instead:
$args['title'] = '<strong>POST FOR: </strong>'. $my_date .' - <strong>' .get_the_title($id). '</strong>';
Thanks,
RikardJuly 27, 2016 at 6:29 pm #665867THat worked for the google chrome tab title but now the post title doesnt show the date anymore, see private for example
July 27, 2016 at 8:52 pm #665939Hey!
It does work totally fine on my local installation – http://i.imgur.com/7bm9xQV.png
Can you please try de-activating all active plugins, flush cache and check if that helps?Best regards,
Yigit -
AuthorPosts
- You must be logged in to reply to this topic.