WordPress.org

Ready to get started?Download WordPress

Forums

Single Latest Posts Lite
Styling Output (3 posts)

  1. red.rover
    Member
    Posted 1 year ago #

    I'm wanting to give the

      and
    • elements a few additional bits of data so that it is styled by jQuery mobile - is there a way to affect output of the list at all?

    http://wordpress.org/extend/plugins/single-latest-posts-lite/

  2. red.rover
    Member
    Posted 1 year ago #

    Whoops it turns my <ul> and <li> into code haha.

  3. Jose Luis SAYAGO
    Member
    Plugin Author

    Posted 1 year ago #

    Hi, well it could be done using jQuery selectors to add missing elements. However, I'll keep your idea in mind for future releases.

    To be more specific about selectors, here's an idea:

    1.- Create a custom script which you can call nlposts-jqmobile.js for example, save it to your theme root folder then add something like this:

    jQuery(document).ready(function(){
    	jQuery(".nlposts-ulist").attr({
    		"data-role": "listview",
    		"data-inset": "true",
    		"data-scheme": "a"
    	})
    });

    2.- Load the script from your theme's functions.php file, like this:

    function nlposts_jqmobile() {
    	wp_enqueue_script(
                   'nlposts-jqmobile',
                   get_template_directory_uri() . '/nlposts-jqmobile.js',
                   array('jquery')
            );
    }
    add_action( 'wp_footer', 'nlposts_jqmobile' );

    That's it, now lists should look like:

    <ul class="nlposts-wrapper nlposts-ulist nav nav-tabs nav-stacked" data-role="listview" data-inset="true" data-scheme="a">
         <li class="nlposts-ulist-litem nlposts-siteid-1">...</li>
         <li class="nlposts-ulist-litem nlposts-siteid-2">...</li>
    </ul>

    If you want to add attributes to LI elements you can repeat the same operation but selecting li classes instead of ul ones.

    Hope this help.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic