Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Post-Kicker, -Byline & -Footer (http://forum.bytesforall.com/forumdisplay.php?f=17)
-   -   The %date-modified('F jS, Y')% in post footer not working (http://forum.bytesforall.com/showthread.php?t=1065)

Glottis Apr 2, 2009 09:38 AM

The %date-modified('F jS, Y')% in post footer not working
 
Hi Flynn,

I put %date-modified('F jS, Y')% in the theme options, and it's being output as is, literally:

%date-modified('F jS, Y')%

I can't figure out what might be causing this.

Thanks in advance for your help.

Flynn Apr 2, 2009 08:18 PM

This is a bug, thanks for finding. To fix it replace in functions/bfa_postinfo.php, line 135

PHP Code:

$postinfo preg_replace("/(.*)%date\((.*?)\)%(.*)/i""\${1}" .$date_modified"\${3}"$postinfo); 

with

PHP Code:

$postinfo preg_replace("/(.*)%date-modified\((.*?)\)%(.*)/i""\${1}" .$date_modified"\${3}"$postinfo); 


Glottis Apr 3, 2009 12:01 PM

Thanks, and I'm glad I could help.

perdox808 Apr 9, 2009 09:20 AM

Hmm. This is rather scary. I have gone to Appearance>Editor and clicked on my bfa_postinfo.php file and did a search for what we have to replace, and my file doesn't have such a line. Gulp! :(

Can I just add the new line? Does it matter where in the excerpt below?

$postinfo = $postinfo_string;
$postinfo = preg_replace("/(.*)%tags\((.*?)\)%(.*)/i", "\${1}" .$tags. "\${3}", $postinfo);
$postinfo = preg_replace("/(.*)%tags-linked\((.*?)\)%(.*)/i", "\${1}" .$tags_linked. "\${3}", $postinfo);
$postinfo = str_replace("%author%", $author, $postinfo);
$postinfo = str_replace("%author-linked%", $author_linked, $postinfo);
$postinfo = preg_replace("/(.*)%date\((.*?)\)%(.*)/i", "\${1}" .$date. "\${3}", $postinfo);
$postinfo = str_replace("%category%", $category_notlinked, $postinfo);
$postinfo = str_replace("%category-linked%", $category_linked, $postinfo);
$postinfo = preg_replace("/(.*)%categories\((.*?)\)%(.*)/i", "\${1}" .$categories. "\${3}", $postinfo);
$postinfo = preg_replace("/(.*)%categories-linked\((.*?)\)%(.*)/i", "\${1}" .$categories_linked. "\${3}", $postinfo);
$postinfo = preg_replace("/(.*)%comments\((.*?)\)%(.*)/i", "\${1}" .$comment_link. "\${3}", $postinfo);
$postinfo = preg_replace("/(.*)%comments-rss\((.*?)\)%(.*)/i", "\${1}" .$comments_rss_link. "\${3}", $postinfo);
$postinfo = str_replace("%trackback%", $trackback_url, $postinfo);
$postinfo = preg_replace("/(.*)%trackback-linked\((.*?)\)%(.*)/i", "\${1}" .$trackback_link. "\${3}", $postinfo);
$postinfo = preg_replace("/(.*)%edit\((.*?)\)%(.*)/i", "\${1}" .$edit. "\${3}", $postinfo);
$postinfo = preg_replace("/(.*)%print\((.*?)\)%(.*)/i", "\${1}" .$print_link. "\${3}", $postinfo);
$postinfo = str_replace("%wp-print%", $wp_print, $postinfo);
$postinfo = str_replace("%wp-email%", $wp_email, $postinfo);
$postinfo = str_replace("%wp-postviews%", $wp_postviews, $postinfo);
$postinfo = str_replace("%wp-postratings%", $wp_postratings, $postinfo);
$postinfo = str_replace("%sociable%", $sociable, $postinfo);

if (strpos($postinfo_string,'<image(')!==false) {
// images
$postinfo = preg_replace_callback("|<image\((.*?)\)>|","image_ files",$postinfo);
}

return $postinfo;
}
?>

I have been rather daring and went ahead and added your line Flynn, so that now I have:

$postinfo = $postinfo_string;
$postinfo = preg_replace("/(.*)%tags\((.*?)\)%(.*)/i", "\${1}" .$tags. "\${3}", $postinfo);
$postinfo = preg_replace("/(.*)%tags-linked\((.*?)\)%(.*)/i", "\${1}" .$tags_linked. "\${3}", $postinfo);
$postinfo = str_replace("%author%", $author, $postinfo);
$postinfo = str_replace("%author-linked%", $author_linked, $postinfo);
$postinfo = preg_replace("/(.*)%date\((.*?)\)%(.*)/i", "\${1}" .$date. "\${3}", $postinfo);
$postinfo = preg_replace("/(.*)%date-modified\((.*?)\)%(.*)/i", "\${1}" .$date_modified. "\${3}", $postinfo);
$postinfo = str_replace("%category%", $category_notlinked, $postinfo);
$postinfo = str_replace("%category-linked%", $category_linked, $postinfo);
$postinfo = preg_replace("/(.*)%categories\((.*?)\)%(.*)/i", "\${1}" .$categories. "\${3}", $postinfo);
$postinfo = preg_replace("/(.*)%categories-linked\((.*?)\)%(.*)/i", "\${1}" .$categories_linked. "\${3}", $postinfo);
$postinfo = preg_replace("/(.*)%comments\((.*?)\)%(.*)/i", "\${1}" .$comment_link. "\${3}", $postinfo);
$postinfo = preg_replace("/(.*)%comments-rss\((.*?)\)%(.*)/i", "\${1}" .$comments_rss_link. "\${3}", $postinfo);
$postinfo = str_replace("%trackback%", $trackback_url, $postinfo);
$postinfo = preg_replace("/(.*)%trackback-linked\((.*?)\)%(.*)/i", "\${1}" .$trackback_link. "\${3}", $postinfo);
$postinfo = preg_replace("/(.*)%edit\((.*?)\)%(.*)/i", "\${1}" .$edit. "\${3}", $postinfo);
$postinfo = preg_replace("/(.*)%print\((.*?)\)%(.*)/i", "\${1}" .$print_link. "\${3}", $postinfo);
$postinfo = str_replace("%wp-print%", $wp_print, $postinfo);
$postinfo = str_replace("%wp-email%", $wp_email, $postinfo);
$postinfo = str_replace("%wp-postviews%", $wp_postviews, $postinfo);
$postinfo = str_replace("%wp-postratings%", $wp_postratings, $postinfo);
$postinfo = str_replace("%sociable%", $sociable, $postinfo);

if (strpos($postinfo_string,'<image(')!==false) {
// images
$postinfo = preg_replace_callback("|<image\((.*?)\)>|","image_ files",$postinfo);
}

return $postinfo;
}
?>


But I still get the literal stuff.

Glottis Apr 9, 2009 01:58 PM

There are 2 bfa_postinfo.php. The one you need to edit isn't accessible from Appearance --> Editor. You can edit it through FTP by going to /wp-content/themes/atahualpa3/functions/bfa_postinfo.php

The one in Editor is located in /wp-content/themes/atahualpa3/bfa_postinfo.php

RobertSGold Apr 9, 2009 04:27 PM

Hey, I am having the same problem, and I edited the correct file as specified, but no effect.

Thanks in advance.

perdox808 Apr 10, 2009 02:12 AM

Thanks to all! I found the file and made the change and the %date-modified% variable now works OK.

Thanks for all your help.

Glottis Apr 10, 2009 05:42 AM

You're welcome, Perdox.

RobertSGold,
After (or before) editing the file /wp-content/themes/atahualpa3/functions/bfa_postinfo.php, did you put %date-modified('F jS, Y')% in the theme options?

perdox808 Apr 10, 2009 06:16 AM

Yes, I got rid of the line I inserted via the Admin>Editor and used the ftp client to copy the file to my machine, edited it (i.e. put that new line of code in), copied it back to server and all was well in my little brain! I was a happy chappy to say the least. Is this the correct procedure? I shouldn't try to edit the file while it is still on the server, should I?

I was working my way through all the options as described in the theme settings in the 'Post/Page Info Items' just out of curiosity. That's how I discovered the problem with the date-modified and the fact that if you put the %author-email% in the configuration fields, it throws the sidebars out. Flynn has already fixed this.

Everything works fine now with the code in the correct file. :):):)

RobertSGold Apr 10, 2009 07:29 AM

Glottis:

Thanks - what wasn't clear to me was that the date format is specified both in the general WP options and in the Post Info Items options.

Working as desired now. Many thanks.

Glottis Apr 10, 2009 07:48 AM

Quote:

Originally Posted by perdox808 (Post 4674)
Yes, I got rid of the line I inserted via the Admin>Editor and used the ftp client to copy the file to my machine, edited it (i.e. put that new line of code in), copied it back to server and all was well in my little brain! I was a happy chappy to say the least. Is this the correct procedure? I shouldn't try to edit the file while it is still on the server, should I?

You did everything correctly, yes. You can edit the file on the server, too. But not through Wordpress's Editor, though, because this particular file isn't accessible from there.

Quote:

Originally Posted by RobertSGold (Post 4679)
Glottis:

Thanks - what wasn't clear to me was that the date format is specified both in the general WP options and in the Post Info Items options.

Working as desired now. Many thanks.

Great, glad it's working now!

Flynn Apr 11, 2009 04:52 AM

The other bfa_postinfo.php, the one in the root directory is there by accident. Sorry about that


All times are GMT -6. The time now is 02:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.