WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i want to use if and else statement on iframe but it's not working if and else statement not working on the iframe php page


 <iframe width="820px" height="1200px" style="overflow:hidden;margin-left:-900px; margin-top:-100px" allowtransparency="true" frameborder="0" src="<?php bloginfo ("template_url")?>/gallery/karachigallery.php" ></iframe>

<?php } else if("p=953") {?>
    <?php }?>
share|improve this question
what are you trying to test with the if statement? – Michael Dec 10 '12 at 14:16
Navigate through this Stack archives, you'll see lots of examples of working code. – brasofilo Dec 10 '12 at 14:38
This appears to be a PHP syntax question, not a WordPress question. – Chip Bennett Dec 10 '12 at 15:06
@ChipBennett i'm using wordpress – edgematrix Dec 10 '12 at 16:39
"I'm using WordPress" - Please refer to the FAQ: Note that we do not handle questions... not specific to WordPress (even if they happen in its context)... If your question is specific to WordPress, you need to edit it to indicate how it is specific to WordPress. As-written, it's simply a question of a PHP conditional clause. – Chip Bennett Dec 10 '12 at 17:11

To test for a post id use get_the_ID():

if ( 947 == get_the_ID() )
    // do something

If you need it outside of a loop you can access the post object’s ID member:

if ( 947 == $post->ID )
    // do something
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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