Forums

PHP on a single page/post (2 posts)

  1. phexus
    Member
    Posted 4 years ago #

    I want to add some PHP code to a single individual page. The code is used to display a list of highest rated and most rated posts on my site. How do I use PHP in a post? I'm thinking I would need to use an IF statement in the page.php file, but I'm not exactly sure what the code would be. My page ID is 196. Can someone tell me the code for doing this? or give me a hint?

    Thanks.

  2. Tdude
    Member
    Posted 4 years ago #

    You could use the following:
    <?php if ( is_page('196')){ ?>
    Here is my page content
    <?php } // this ends the if statement ?>

    You could also write the page slug instead of the id number. However, you should probably read up on wordpress template tags and conditional tags first ;)
    Hint:
    http://codex.wordpress.org/Template_Tags
    http://codex.wordpress.org/Conditional_Tags
    Happy coding,
    T

Topic Closed

This topic has been closed to new replies.

About this Topic