Support » Fixing WordPress » Programming inside of a page

  • eselby

    (@eselby)


    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)

Viewing 1 replies (of 1 total)
  • Moderator Mark Ratledge

    (@songdogtech)

    Forum Moderator

    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

Viewing 1 replies (of 1 total)
  • The topic ‘Programming inside of a page’ is closed to new replies.