Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Kailey (trepmal)

    (@trepmal)

    Look under Template Tag in the Other Notes section.

    <?php
    $args = array(
            'title' => __( 'Recent Posts', 'mini-loops' ),
            'hide_title' => 0,
            'title_url' => '',
            'number_posts' => 3,
            'post_offset' => 0,
            'post_type' => 'post',
            'post_status' => 'publish',
            'order_by' => 'date',
            'order' => 'DESC',
            'reverse_order' => 0,
            'shuffle_order' => 0,
            'ignore_sticky' => 1,
            'only_sticky' => 0,
            'exclude_current' => 1,
            'categories' => '',
            'tags' => '',
            'tax' => '',
            'custom_fields' => '',
            'exclude' => '',
            'before_items' => '<ul>',
            'item_format' => '<li><a href="[url]">[title]</a><br />[excerpt]</li>',
            'after_items' => '</ul>',
            );
    miniloops( $args );
    ?>

    ($args is showing default values)

    How do I amend this code to change the options? You have the default values listed, but what can they be changed to?

    eg.
    ‘shuffle_order’ => 0 ,
    if 0 is changed to 1 the text is corrupt

    ‘item_format’ => '<li><a href="[url]">[title]</a>[excerpt]</li>',
    if I add your example code from the ‘other notes’ section into the ” (removing all other text), the page will not open.

    Ideally I’d like one section listing the recent 5 posts, and then another listing 5 random posts from the past, is there a way I can do this?

    Thanks for your help

    Plugin Author Kailey (trepmal)

    (@trepmal)

    Hopefully this will help you understand possible values for each argument.

    <?php
    // boolean: 0=false, 1=true
    $args = array(
            'title' => 'Your Title', // the heading for the output
            'hide_title' => 0, // boolean
            'title_url' => '', // a valid url, where the heading should link to
            'number_posts' => 3, // any number, how many posts to show
            'post_offset' => 0, // any number, how many posts to skip
            'post_type' => 'post', // any valid post type
            'post_status' => 'publish', // any valid post status
            'order_by' => 'date', // 'id', 'author', 'title', 'date', 'modified', 'parent', 'rand', 'comment_count', 'menu_order'
            'order' => 'DESC', // 'DESC' or 'ASC'
            'reverse_order' => 0, // boolean
            'shuffle_order' => 1, // boolean
            'ignore_sticky' => 1, // boolean
            'only_sticky' => 0, // boolean
            'exclude_current' => 1, // boolean
            'categories' => '', // comma separated list of category IDs
            'tags' => '', // comma separated list of tag IDs
            'tax' => '', // query-string style taxonomy-termID pairs (Ex: category=1,2,4&post_tag=6,12)
            'custom_fields' => '', // query-string style key-value pairs (Ex: meta_key=meta_value&key2=value2)
            'exclude' => '', // comma separated list if post IDs to exclude
            'before_items' => '<ul>', // html at beginning of output
            'item_format' => '<li><a href="[url]">[title]</a><br />[excerpt]</li>', // html format for each result
            'after_items' => '</ul>',// html at end of output
            );
    miniloops( $args );
    ?>

    I’m not sure why 'shuffle_order' => 1 would result in corrupted text. I’m unable to replicate this issue.

    If you’re copying my example formats directly into the miniloops() function instead of the widget field, you’ll have to replace the single quotes (should be 2, around the fallback parameter in the [image] shortcode) with double quotes. That should prevent the page from breaking.

    Here’s the very simple code for getting the 5 most recent posts, and then 5 random posts. However, the 5 random posts *may* contain some of the 5 most recent posts. There’s not currently an easy way to avoid this.

    <?php
    //5 recent posts
    $args = array(
            'number_posts' => 5,
            );
    miniloops( $args );
    
    //5 random posts
    $args = array(
            'number_posts' => 5,
            'order_by' => 'rand'
            );
    miniloops( $args );
    ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Mini Loops] place in template’ is closed to new replies.