Title: Plugin the_content problem
Last modified: August 19, 2016

---

# Plugin the_content problem

 *  [onigetoc](https://wordpress.org/support/users/onigetoc/)
 * (@onigetoc)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/plugin-the_content-problem/)
 * Hi,
 * I whant to create my first plugin and i started from a basic plugin to add it
   after the post content using add_action the_content and it work. but if i add
   a require_once or include in my plugin. the included appear on top of the content
   and not under. did some people fixed same issue with included content apearing
   like me on the top of the post content?
 * All other code are at the right place but not the included content. I tested 
   that if you open and close php code in your plugin it do the same thing. Why 
   this happen?
 * Some this like that
 *     ```
       function socialstars_display($content)
       {
       	// this is where we'll display the Stars Social
   
       	$options['page'] = get_option('socialstars_on_page');
       	$options['post'] = get_option('socialstars_on_post');
   
       	if ( (is_single() && $options['post']) || (is_page() && $options['page']) || (is_page(3777) && $options['post']) )
       	{
   
       		$searchform = require_once(dirname(__FILE__).'/includes/test.php');
       		//$searchform = include 'includes/searchform2.php';
       		//$starsinfos = require_once(dirname(__FILE__).'/includes/stars-infos.php');
   
       		$socialstars_box = '<h2>Photoset '.get_the_title().'</h2>[flickr-gallery mode="search" tags="'.get_the_title().'"]'.
   
       // RSS NEWS
       // http://news.google.com/news?cf=all&ned=us&hl=en&q='.$artistencode.'&cf=all&output=rss
       // http://news.search.yahoo.com/news/rss?p='.$artistencode.'&ei=UTF-8&fl=0&x=wrt
       '<h2>News '.get_the_title().'</h2>';
       $artistencode = urlencode(get_the_title());  
   
       include_once(ABSPATH.WPINC.'/rss.php'); // path to include script
       $feed = fetch_rss('http://news.search.yahoo.com/news/rss?p='.$artistencode.'&ei=UTF-8&fl=0&x=wrt'); // specify feed url
       $items = array_slice($feed->items, 0, 7); // specify first and last item
   
       if (!empty($items)) :
       foreach ($items as $item) : 
   
       echo '<h3><a href="'.$item['link'].'"  target="_blank">'.$item['title'].'</a></h3>'.$item['description'].'';
       endforeach;
       endif;
       // RSS NEWS END
       	;
   
       		return $content . $socialstars_box;
       	} else {
       		return $content;
       	}
       }
   
       add_action('the_content', 'socialstars_display');
       ```
   
 * Even a very simple include doesn’t work like,
 * `$socialstars_box = require_once(dirname(__FILE__).'/includes/test.php');`
 * The included file will appear over the post content in a post page.

The topic ‘Plugin the_content problem’ is closed to new replies.

## Tags

 * [include_once](https://wordpress.org/support/topic-tag/include_once/)
 * [require_once](https://wordpress.org/support/topic-tag/require_once/)
 * [the_content](https://wordpress.org/support/topic-tag/the_content/)

 * 0 replies
 * 1 participant
 * Last reply from: [onigetoc](https://wordpress.org/support/users/onigetoc/)
 * Last activity: [15 years, 3 months ago](https://wordpress.org/support/topic/plugin-the_content-problem/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
