WordPress.org

Ready to get started?Download WordPress

Forums

Programming inside of a page (2 posts)

  1. eselby
    Member
    Posted 4 years ago #

    I need to create dynamic content based on if/then statements. For instance, if condition=yes then display content a, else display content b.

    Can this be done inside a WP page? So far attempts to do this have failed (probably due to my still learning php)

  2. One problem might be that if you're using php in the wordpress editor, you need to have php exceuction enabled: Exec-PHP « WordPress Plugins. If you're using php in a page template, then try something like:

    <?php if (is__front_page('1')) { ?>  something here
    
    <?php } elseif (is_page('2')) { ?>  omething here
    
    <?php } else { ?>  omething here
    
    <?php } ?>

    and see Conditional Tags « WordPress Codex

Topic Closed

This topic has been closed to new replies.

About this Topic