WordPress.org

Forums

[resolved] dynamic sidebar php inside echo? (3 posts)

  1. kryvulena
    Member
    Posted 2 years ago #

    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 :-)

  2. 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)

  3. kryvulena
    Member
    Posted 2 years ago #

    Thank you so much!

    Merry Christmas :-)

Topic Closed

This topic has been closed to new replies.

About this Topic