0

This is what i am trying to achieve but i am not sure how:

  • I would like to check if a specific post is published or not
  • If it' not published, it should hide a specific button and show a different one in it's place

I think it's a combination of PHP and CSS but i'm not really sure where to start.

Thank you in advance for your help Charis

0

You can use get_post_status(ID) to check to see if the post is published. You'll need to pull the post ID (through WP Query/loop/etc)

if (get_post_status( $ID ) == "publish"){
    #Show Published Button
} else {
    #Show Not Published Button
} 

Get Post Status in the Codex

  • Thanks for your response, it pointed me to the right direction! – thundertrax Nov 12 '14 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.