Get a free trial // Grow your CSS skills // Land your dream job

WordPress php include issue.

  • # October 30, 2012 at 5:37 am

    I have this line on another site that isn’t using wordpress and it works fine. I just need to know how to get this working in wordpress. This is going into the header area.

    < ?php include_once('/php/news.php'); ?>

    # October 30, 2012 at 6:56 am

    Where is your `news.php` file located in your theme?

    # October 30, 2012 at 6:57 am

    In a php folder. Really doesn’t matter where I put it.

    # October 30, 2012 at 9:23 am

    In fact it does when dealing with wordpress…

    You can not simply call it relatively, you need to call it absolutely using the WordPress constant “TEMPLATEPATH” like this:

    < ?php include _once(TEMPLATEPATH . '/php/news.php'); ?>
    # October 30, 2012 at 1:00 pm

    Sorry I meant it really didn’t matter where I put it in the theme folder. That is what I had after numerous searching and tries. Well except I had `” “` instead of `’ ‘`. So I can see all the stuff is display in a list, but doesn’t rotate.

    Not sure what is the right way to include extra js files. Anyways I’m off to work. BBL.

    # October 30, 2012 at 8:15 pm


Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed