Adding post footer
There are a lot of plugins for adding footers to WordPress posts and one of them is so called “Add Post URL” plugin written by some Chinese guys. From my perspective, its benefits includes macros support and ability to decide whether or not to display the footer for each post individually. It worked fine for me and I even improved it a little bit. The following code snippet shows how I added “post_id” macro:
$footer_text = $posturl_options['footer_text'];
$footer_text = trim($footer_text);
if (!empty($footer_text))
{
//remove_filter( 'the_content', 'wpautop' );
$post_id = get_the_ID();
$footer_text = str_replace("%post_id%", $post_id, $footer_text);
$footer_text = str_replace("%site_url%", site_url('/'), $footer_text);
$footer_text = str_replace("%site_name%", get_bloginfo('sitename'), $footer_text);
$footer_text = str_replace("%post_url%", get_permalink(), $footer_text);
$footer_text = str_replace("%post_title%", the_title('', '', false), $footer_text);
$footer_text = stripslashes($footer_text);
$text .= $footer_text;
}
(more…)