Cameron
Cameron

Reputation: 28853

PHP conditional on query string with id

I have this code:

    if('open' == $post->comment_status || !isset($_GET['wp_accept_favor']))
    {

// show comment form

    }
else
{
    // dont show comment form
    }

domain.com/?wp_accept_favor then show comment form

domain.com/?wp_accept_favor=2 then dont show comment form

How do I do that? Thanks

Upvotes: 0

Views: 262

Answers (1)

Gaurav
Gaurav

Reputation: 28765

if('open' == $post->comment_status || 
             (isset($_GET['wp_accept_favor']) && empty($_GET['wp_accept_favor'])) )
{

    // show comment form

}
else if(isset($_GET['wp_accept_favor']) && !empty($_GET['wp_accept_favor']))
{
    // do not show comment form 
}

Upvotes: 1

Related Questions