WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Using Functions with code that contains (5 posts)

  1. dyyyb
    Member
    Posted 1 year ago #

    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>
    </div>
    <div class="column-sidebar nomargin">
    <?php do_action('shop_sidebar'); ?>
    </div>
    </div>
    </div>

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

  2. Andrew
    Forum Moderator
    Posted 1 year ago #

    What do you mean

    I(t) doesn't work
    ?

    Elaborate.

  3. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    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?

  4. dyyyb
    Member
    Posted 1 year ago #

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

  5. emilybrown125
    Member
    Posted 1 year ago #

    Hi,

    You can use the following code:

    var url = "http:\\Google.com"

    if(url.indexOf(url) !=
    -1)

    {

    //it means url contains Google word.

    }

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

    Regards,
    [signature moderated]

Topic Closed

This topic has been closed to new replies.

About this Topic