Forums

find if page exists and is published (1 post)

  1. cclinton
    Member
    Posted 1 year ago #

    I am looking to set up php code that does this:
    * if a page exists
    * and is published (versus) draft
    * places something on the page

    I found this on an earlier discussion:
    <?php if(get_page_by_title('Page Title')) : ?>
    [do stuff]
    <?php endif;?>

    It's missing the published check and I am not sure how to add that, if that's even possible.

    Why: I have a page that get's turned on and off depending on the time of year. On another page there is a paragraph and link related to this page that I only want to appear when the first page is published. During the offseason this first page get's converted to draft stage.

Topic Closed

This topic has been closed to new replies.

About this Topic