-
AuthorPosts
-
October 27, 2014 at 5:59 pm #341632
Hi –
GOAL: Replace the default “Blog – Latest News” titleI’ve followed the instructions given in documentation:
http://kriesi.at/documentation/enfold/replace-the-default-blog-latest-news-title/The result on my site is revealing the code given in the documentation. What is going wrong?
October 29, 2014 at 7:56 am #342591Hi Julie!
You are missing the PHP opening tag
<?php
, functions.php should look like this:<?php 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; }
Cheers!
JosueOctober 29, 2014 at 3:42 pm #342751Hi Josue,
Thanks for the code. However, it didn’t replace the “Blog – Latest News” header with the post title. Instead, it now says “Blogs” on each post. See example: http://wels.staging.wpengine.com/wels-night-brewers/ (hosted on WPengine) where instead I expected “WELS Night at the Brewers”. I must be missing something. Oh, and thanks for pointing out the opening php code (and closing code I figured out as well).
Thoughts on the “Blogs” title appearing rather than the post title?
jOctober 29, 2014 at 4:54 pm #342805Hi,
Can you please create us a WordPress administrator account? post it here as a private reply.
Regards,
JosueOctober 29, 2014 at 5:46 pm #342838This reply has been marked as private.October 29, 2014 at 6:33 pm #342883Sure, can you please enable file editing or provide a temporary FTP account so i can edit the child theme functions.php file?
Cheers!
JosueOctober 29, 2014 at 7:40 pm #342937This reply has been marked as private.October 29, 2014 at 8:48 pm #342969Please re-check, i’m getting this error – http://screencast.com/t/cV484Vz5
Regards,
JosueOctober 29, 2014 at 9:59 pm #343017This reply has been marked as private.October 29, 2014 at 10:46 pm #343048Hey!
Check it now, i changed the code to this:
add_filter('avf_title_args', 'fix_single_post_title', 10, 2); function fix_single_post_title($args,$id) { if ( is_singular('post') ) { $args['title'] = get_the_title($id); $args['link'] = get_permalink($id); $args['heading'] = 'h1'; } return $args; }
Best regards,
JosueOctober 30, 2014 at 12:32 am #343100Awesome! The code… worked as shown below. (Opening and closing PHP code assumed.) CLOSE TICKET and BIG thanks!
add_filter(‘avf_title_args’, ‘fix_single_post_title’, 10, 2);
function fix_single_post_title($args,$id)
{
if ( is_singular(‘post’) )
{
$args[‘title’] = get_the_title($id);
$args[‘link’] = get_permalink($id);
$args[‘heading’] = ‘h1’;
}return $args;
}October 30, 2014 at 1:32 am #343143You are welcome, glad to help :)
Regards,
JosueMarch 25, 2015 at 5:20 pm #417943Please close this ticket. Thank you!
-
AuthorPosts
- The topic ‘Latest Blogs – Function.php Code Displaying the FIX’ is closed to new replies.