• Resolved chugs

    (@chugs)


    How does one add classes to wpp_start and post_html tags

    Using shortcode –
    <?php echo do_shortcode( '[wpp wpp_start=<ul class=class> wpp_end=</ul>]' ); ?>

    or
    <?php echo do_shortcode( '[wpp wpp_start=<ul class="class"> wpp_end=</ul>]' ); ?>

    returns
    <ul <li=""></ul>

    Using template tags –

    This works
    <?php wpp_get_mostpopular('&wpp_start="<ul class=classone>"&wpp_end="</ul>"'); ?>

    But not this

    <?php
    if (function_exists('wpp_get_mostpopular'))
    wpp_get_mostpopular('&wpp_start="<ul class=classone classtwo>"&wpp_end="</ul>"');
    ?>

    returns
    <ul class="classone" classtwo=""></ul>

    https://www.ads-software.com/plugins/wordpress-popular-posts/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hi there!

    When adding attributes to the HTML tags you need to escape them, like so:

    <?php
    if (function_exists('wpp_get_mostpopular'))
    	wpp_get_mostpopular('wpp_start="<ul class=\'classone classtwo\'>"&wpp_end="</ul>"');
    ?>

    Alternatively, you can also use arrays to pass the parameters to the template tag:

    <?php
    if (function_exists('wpp_get_mostpopular'))
    	wpp_get_mostpopular( array('wpp_start' => '<ul class="classone classtwo">', 'wpp_end' => '</ul>') );
    ?>
    Thread Starter chugs

    (@chugs)

    That works. Thanks a lot!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to add classes to wpp_start and post_html tags’ is closed to new replies.