WordPress.org

Ready to get started?Download WordPress

Forums

Filter to add content to post (2 posts)

  1. Frank San
    Member
    Posted 2 years ago #

    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.

  2. Tara
    Member
    Posted 2 years ago #

    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' );

Topic Closed

This topic has been closed to new replies.

About this Topic