WordPress.org

Ready to get started?Download WordPress

Forums

Inline PHP for WordPress 2.8.6 (Conditional) (3 posts)

  1. 1xxooxx
    Member
    Posted 4 years ago #

    WORDPRESS VERSION: 2.8.6 (I just did an upgrade from 2.7. everything was working GREAT with 2.7!!)

    INLINE PHP TO RUN (pasted on the first line of EVERY article):
    < ?php if (is_single()) { ?>
    < ?php include (TEMPLATEPATH . '/ads-single-top.php'); ?>
    < ?php } ?>
    (which basically is a conditional php code that includes adsense ONLY when viewing the article in single.php)

    The php works great when viewing the article in single.php.. but once it comes to index.php.. it doesnt work. On index.hph I am using "<?php the_excerpt() ?>"

    I tried searching for plugins that RUN PHP INLINE code.. and they work.. but only on single.php (like I said before)

  2. 1xxooxx
    Member
    Posted 4 years ago #

    UPDATE: I fixed the problem by the help of this post ( http://wordpress.org/support/topic/281992?replies=3#post-1150732 )

    OPEN: plugin folder - exec-php/include/runtime.php
    FIND:

    function filter_user_content($content)
    	{
    		global $post;

    ADD AFTER:

    if(strpos($content,'< ?php ')!==FALSE)
    	{
    		$content=str_replace('< ?php','<?php',$content);
    	}

    HUGE THANKS TO mmorpglife!!!! http://wordpress.org/support/topic/281992?replies=3#post-1150732

  3. McShelby
    Member
    Posted 4 years ago #

    This is an issue introduced with WordPress 2.8. See http://core.trac.wordpress.org/ticket/10248

Topic Closed

This topic has been closed to new replies.

About this Topic