• Resolved GrahamW

    (@grahamw)


    Hello, I’m trying to add some content to the beginning of a blog post. I want it to do it upon page load, and not write it to the database. I tried add_action('the_content', 'test'); but this added it to the pages as well as the posts. I tried looking for my answer in the Sexy Bookmarks plugin, but failed.

Viewing 1 replies (of 1 total)
  • Thread Starter GrahamW

    (@grahamw)

    I managed to fall onto the answer after looking for a few hours. You have to use the !is_page() function. Here is my code:

    function test ($text)
    {
    	if(!is_feed() && !is_page())
    	{
    		$text = 'I\'m Confused'.$text;
    	}
    	return $text;
    }
    add_action('the_content', 'test');

Viewing 1 replies (of 1 total)
  • The topic ‘Add content to beginning of a post, NOT page’ is closed to new replies.