Support » Fixing WordPress » dynamic sidebar php inside echo?

  • Resolved kryvulena

    (@kryvulena)


    Hello

    I don’t know much of php (I prefer designing than programming…) but I must re-code a few php lines and I need help.

    I wish I inserted a dynamic sidebar’s code:

    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("mysidebar") ) ; ?>

    into:

    <?php
    		if (is_home()) {
    				echo "...";
    
    		} elseif (is_page('5')) {
    				 echo " H E R E ";
    
    		} else {
    				echo "...";
    		}
    ?>

    I’d be very grateful for any help!

    Greetings 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • Michael

    (@alchymyth)

    Forum Moderator

    don’t use this section at all in your conditional code:

    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("mysidebar") ) ; ?>

    instead try:

    <?php
    		if (is_home()) {
    				echo "...";
    
    		} elseif (is_page('5')) {
    				 dynamic_sidebar("mysidebar");
    
    		} else {
    				echo "...";
    		}
    ?>

    (untested)

    Thank you so much!

    Merry Christmas 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘dynamic sidebar php inside echo?’ is closed to new replies.