Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a gallery page wherein there are multiple individual galleries/sub-pages. I handle this function by using-

<?php     
    if( is_page( 39 ) ) {
    echo do_shortcode('[nggallery id=1]');
    } else {
    }
?>

I'm wondering, is there a way to include page specific content in that? For example, if that code is used to show A's gallery, how can I include A's bio info within that statement(using <p>)?

share|improve this question
    
It's not clear exactly what your meaning. Does echo "<p>stuff</p>"; not work? Your shortcode is already specific to post/page 39 –  Tom J Nowell Oct 4 '12 at 16:34
    
Sorry for not being clear; I've not worked with many conditional statements like this before. If echo "<p>stuff</p>"; is supposed to work, how can I include that in addition to the gallery info? –  user1255049 Oct 4 '12 at 16:36
    
put it on the next line, you should read up on some more PHP –  Tom J Nowell Oct 4 '12 at 16:43
add comment

1 Answer 1

up vote 1 down vote accepted

You can do that via echo, just place it on a new line inside the if conditionals braces { and }

e.g.

if(this statement is true)
{ // <- do everything between here
     /*
     stuff that happens if the statement is true
     */
} // <-- and here

else
{
     // stuff that happens if the statement is not true
}

So you could do this:

if( is_page( 39 ) ) {
    echo do_shortcode('[nggallery id=1]');
    // add more stuff here, e.g. echo "<p>Bio info etc</p>";
    echo "<p>Bio</p>";
}
share|improve this answer
add comment

Your Answer

 
discard

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.