WordPress.org

Support

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

Filter to add content to post

  • Frank San
    Member

    @frank-san

    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 />";
                  $exitxml.=$fuente[0];
                  }
          	      $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.
    Regards.

Viewing 1 replies (of 1 total)
  • Tara
    Volunteer 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.