WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Using Functions with code that contains

[Resolved] Using Functions with code that contains

  • 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…

Viewing 4 replies - 1 through 4 (of 4 total)
  • What do you mean

    I(t) doesn’t work

    ?

    Elaborate.

    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 😉

    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]

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