Forums

[resolved] Make non-WP page recognize conditional? (2 posts)

  1. doodlebee
    Member
    Posted 5 years ago #

    I was wondering, really quickly, if there was something I could place in the top of a non-WordPress handled page that would make WordPress recognize it as a non-WordPress page, and I could write a conditional statement for it?

    To try and give a better explanation, I have a page that is outside of WordPress. However I've brought in the wp-blog-header.php file in the top, so I can use WordPress calls for the layout (get_header() and all that). However, I have a number of conditional statements for the whole site, and I need this non-WordPress page to have the same layout as my Pages (I'm using a body id="page" thing). But the conditional doesn't recognize the non-WP page, and is giving it the default blank body tag. It's totally understandable *why* it's doing this, but I can't seem to come up with the right code snippet to place in the non-WP page to "tag" the page with something so I can make the WP conditional recognize what it is, and serve the right body ID.

    Man, I hope that made sense.

  2. doodlebee
    Member
    Posted 5 years ago #

    Crap. 5 minutes go by, and I've figured it out.

    I added:

    <?php if($postID == "") { ?>
    <body id="nonWP">
    <?php } ?>

    So it looks to see if there's any post ID set for the page. If not, it's not a WP page, and therefore gets the new ID. Yay!

    Haven't completely tested it out yet, but so far, I'm good.

Topic Closed

This topic has been closed to new replies.

About this Topic