Support » Plugins » Hacks » Filter to add content to post

  • I trying to code a plugin for add content to the_content.

    I code this:

    .....if(is_home()) {
            foreach ($rows as $row) {
                  $exitxml.=$row->post_content."<br />";
          	      $content = print_r($exitxml);
    	 return $content;
    add_filter ('the_content', 'publicaratom');

    This code filter every post, but i need filter only the_content of the last post i publishing, because i pass diferent data for each post from meta_box.

Viewing 1 replies (of 1 total)
  • Moderator t-p


    try something like:

    function mytheme_content_filter( $content ) {
         // Do stuff to $content, which contains the_content()
         // Then return it
         return $content;
    add_filter( 'the_content', 'mytheme_content_filter' );
Viewing 1 replies (of 1 total)
  • The topic ‘Filter to add content to post’ is closed to new replies.