Support » Fixing WordPress » Using Functions with code that contains

  • Resolved dyyyb


    Hello Community!

    I’m sure it’s quite easy to do, but i am not so talented ;]

    I have to make a function that outputs:

    <div class="column-sidebar nomargin">
    <?php do_action('shop_sidebar'); ?>

    But when i make a function:

        echo '</div></div>';
    	echo '<div class="column-sidebar nomargin"><?php do_action('shop_sidebar'); ?></div>';
    	echo '</div></div>';

    I doesn’t work…

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Andrew Nevins


    Forum moderator

    What do you mean

    I(t) doesn’t work





    Forum Moderator

    the one line mixes strings and php;

    try and rewrite it to:

    echo '<div class="column-sidebar nomargin">'; do_action('shop_sidebar'); echo '</div>';

    btw: that is alot of closing divs in the output of that function – are you sure that results in valid html code?

    Yes, my theme contain a few divs 🙂 And that function is for wrapping a specific plugin – Jigoshop. My sidebar is in this particular place and i had to place it somehow there.

    Thank You alchymyth! It works like a charm 😉


    You can use the following code:

    var url = “http:\\”

    if(url.indexOf(url) !=


    //it means url contains Google word.


    indexOf returns the position of the word in the string. If not found, it will return -1

    [signature moderated]

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Using Functions with code that contains’ is closed to new replies.