WordPress.org

Plugin Directory

Changeset 623534


Ignore:
Timestamp:
11/11/12 04:54:41 (17 months ago)
Author:
trepmal
Message:

dev updates

Location:
mini-loops/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • mini-loops/trunk/form.php

    r606346 r623534  
    4141            </label> 
    4242        </p> 
     43        <p> 
    4344        <p style="width:48%;float:left;"> 
    4445            <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Type:', 'mini-loops' );?> 
     
    8586                    $obs = array( 'ASC', 'DESC' ); 
    8687                    foreach($obs as $v) { 
    87                         echo "<option value='{$v}" . selected( $v, $order, false ) . ">{$v}</option>"; 
     88                        echo "<option value='{$v}'" . selected( $v, $order, false ) . ">{$v}</option>"; 
    8889                    } 
    8990                ?> 
     
    153154            </label> 
    154155        </p> 
    155         <p> 
    156156            <label for="<?php echo $this->get_field_id('tax'); ?>"><?php _e('Custom Taxonomies:', 'mini-loops');?> 
    157157                <input class="widefat" id="<?php echo $this->get_field_id('tax'); ?>" name="<?php echo $this->get_field_name('tax'); ?>" type="text" value="<?php echo $tax; ?>" /><br /> 
  • mini-loops/trunk/helpers.php

    r606346 r623534  
    172172 
    173173        $before_items = do_shortcode( miniloops_shortcoder( stripslashes( $before_items ) ) ); 
    174         $before_items = apply_filters( 'miniloops_before_items_format', $before_items, $query ); 
     174        $before_items = apply_filters( 'miniloops_before_items_format', $before_items, $query, $miniloop ); 
    175175        $postlist .= $before_items; 
    176176 
     
    188188 
    189189        $after_items = do_shortcode( miniloops_shortcoder( stripslashes( $after_items ) ) ); 
    190         $after_items = apply_filters( 'miniloops_after_items_format', $after_items, $query ); 
     190        $after_items = apply_filters( 'miniloops_after_items_format', $after_items, $query, $miniloop ); 
    191191        $postlist .= $after_items; 
    192192 
    193193    endif; 
    194194 
    195     wp_reset_query(); 
     195    wp_reset_postdata(); 
    196196 
    197197    return $postlist; 
     
    209209    $input = str_replace( '[ml_ml_', '[ml_', $input ); 
    210210    $input = str_replace( '[/ml_ml_', '[/ml_', $input ); 
     211    $input = str_replace( '[ml_ba_', '[ba_', $input ); 
     212    $input = str_replace( '[/ml_ba_', '[/ba_', $input ); 
    211213    //a hack: 2 shortcodes touching has issues 
    212214    //%%%%% is a placeholder to be removed during output 
     
    415417add_shortcode( 'ml_category' , 'miniloop_category' ); 
    416418function miniloop_category( $atts ) { 
    417     $atts = shortcode_atts(array( 
     419    $atts = shortcode_atts( array( 
    418420        'separator' => ', ', 
    419421        'link' => false, 
     
    428430add_shortcode( 'ml_tag' , 'miniloop_tag' ); 
    429431function miniloop_tag( $atts ) { 
    430     $atts = shortcode_atts(array( 
     432    $atts = shortcode_atts( array( 
    431433        'separator' => ', ', 
    432434        'link' => false, 
     
    464466} 
    465467 
     468// BETA - not fully tested, may not work under some conditions 
     469// 'ba' prefix for 'before/after' - special hackish use 
     470add_shortcode( 'ba_archive' , 'miniloop_archive' ); 
     471function miniloop_archive( $atts ) { 
     472    extract( shortcode_atts( array( 
     473        'before' => '<p>', 
     474        'after' => '</p>', 
     475    ), $atts ) ); 
     476 
     477    return "{$before}##replace|archive##{$after}"; 
     478} 
     479// For use with the BETA [ba_archive] shortcode 
     480add_filter( 'miniloops_before_items_format', 'ml_hackish_filter', 10, 3 ); 
     481add_filter( 'miniloops_after_items_format', 'ml_hackish_filter', 10, 3 ); 
     482function ml_hackish_filter( $before_items, $query, $miniloop ) { 
     483    // if there is nothing to replace, carry on... 
     484    if ( strpos( $before_items, '##replace' ) === false ) return $before_items; 
     485 
     486    // if the miniloop query is an archive, swap the placeholder for an archive link 
     487    if ( $miniloop->is_archive() ) { 
     488        $obj = $miniloop->get_queried_object(); 
     489 
     490        if ( is_a( $obj, 'WP_User' ) ) { 
     491            $name = $obj->data->display_name; 
     492            $url = get_author_posts_url( $obj->data->ID ); 
     493        } else if ( is_a( $obj, 'stdClass' ) ) { // taxonomy 
     494            $name = $obj->name; 
     495            $url = get_term_link( $name, $obj->taxonomy ); 
     496        } 
     497        $before_items = str_replace('##replace|archive##', "<a href='$url'>$name</a>", $before_items ); 
     498    } 
     499    else 
     500        $before_items = str_replace('##replace|archive##', '', $before_items ); 
     501 
     502    return $before_items; 
     503} 
     504 
    466505add_shortcode( 'ml_date' , 'miniloop_date' ); 
    467506function miniloop_date( $atts ) { 
     
    480519    ), $atts ) ); 
    481520 
    482     $post_type_obj = get_post_type_object( get_post_type() ); 
    483     $post_type_name = $post_type_obj->labels->$label; 
    484     //return '<pre>'. print_r( $post_type_obj->labels, true ) .'</pre>'; 
     521    $post_type_obj = get_post_type_object( get_post_type() ); 
     522    $post_type_name = $post_type_obj->labels->$label; 
    485523    return $post_type_name; 
    486524} 
  • mini-loops/trunk/mini-loops.php

    r606346 r623534  
    44Plugin URI: http://trepmal.com/plugins/mini-loops/ 
    55Description: Query posts and display them where you want 
    6 Version: 1.1.3-dev 
     6Version: 1.1.3-dev-121110 
    77Author: Kailey Lampert 
    88Author URI: http://kaileylampert.com 
  • mini-loops/trunk/readme.txt

    r596056 r623534  
    66Tested up to: 3.4 
    77Stable tag: 1.1.2 
     8License: GPLv2 or later 
    89 
    910Get recent posts, posts from categories, and more. Display as widget or with shortcodes and template tags. 
     
    6869Explanation of options: 
    6970 
    70 **Title:** Your recent posts widget's title on your sidebar. 
    71 `title="Recent Posts"` 
    72  
    73 **Title URL:** The page the title should link to. 
    74 `title_url="/blog/"` 
    75  
    76 **Number of Posts:** Number of posts to be displayed 
    77 `number_posts=3` 
    78  
    79 **Post Offset:** Number of posts to skip before displaying the list 
    80 `post_offset=0` 
    81  
    82 **Maximum Age:** Don't show posts more than X days old 
    83 `maximum_age=0` 
    84  
    85 **Post Author:** Get author's post. By ID. 
    86 `post_author=0` 
    87  
    88 **Post Type:** Post type to display 
    89 `post_type=post` 
    90  
    91 **Post Status:** Post status to display. Primarily useful to show upcoming (future) posts. But be creative! 
    92 `post_status=publish` 
    93  
    94 **Order By:** What order the posts should be displayed in 
    95 `orderby=date` 
    96  
    97 **Order:** Ascending (good for order by title) or Descending (good for order by date) 
    98 `order=DESC` 
    99  
    100 **Meta Key for ordering:** If order by = meta value, specify a key 
    101 `meta_value=some_key` 
    102  
    103 **Show posts in reverse order?** Perhaps you want the 3 most recent posts, but you want the oldest of those to be displayed first. If so, check this. 
    104 `reverse_order=0` 
    105  
    106 **Shuffle post order?** Shuffle the order of the posts matching your query. Perhaps showing the 5 most recent posts in randomized order. 
    107 `shuffle_order=0` 
    108  
    109 **Ignore sticky posts?** Treat sticky posts as normal posts. I recommend ignoring, or the number of posts displayed may be inconsistent. 
    110 `ignore_sticky=1` 
    111  
    112 **Exclude sticky posts?** Don't show sticky posts at all. 
    113 `exclude_sticky=0` 
    114  
    115 **Only sticky posts?** Show only sticky posts. 
    116 `only_sticky=0` 
    117  
    118 **If viewing a single post, exclude it?** If viewing a single post, remove it from the widget display. 
    119 `exclude_current=1` 
    120  
    121 **Get posts from current category (if archive)?** If viewing an archive, only show posts from the same category. 
    122 `current_category=1` 
    123  
    124 **Get posts from first category (if single)?** If viewing a single post, only show posts from the first category. 
    125 `current_single_category=1` 
    126  
    127 **Get posts from current author (if single or archive)?** Show more posts from the current author. 
    128 `current_author=1` 
    129  
    130 **Categories:** Comma separated list of category IDs to pull from. Use negative ID numbers to exclude a category. 
    131  
    132 **Tags:** Comma separated list of tag IDs to pull from. Use negative ID numbers to exclude a tag. 
    133  
    134 **Custom Taxonomies:** A clunky way to support custom taxonomies. To include terms 5, 6, 9 from taxonomy "Genre" do this: 
    135 `tax="genre=5,6,9"` 
    136  
    137 **Custom Fields:** For listing posts that have certain meta data. To list posts that have a custom field 'favorite_color' with a value of 'blue' do this: 
    138 `custom_fields="favorite_color=blue"` 
    139  
    140 **Exclude Posts:** A comma separated list of post IDs to exclude. 
    141  
    142 **Before Item:** Text/HTML to insert before the post list 
    143  
    144 **After Item:** Text/HTML to insert after the post list 
     71**Title:** Your recent posts widget's title on your sidebar. Default: Recent Posts 
     72`[miniloop title="Recent Posts"] 
     73get_miniloops( array('title' => 'Recent Posts' ) );` 
     74 
     75**Title URL:** The page the title should link to. Default: none 
     76`[miniloop title_url="/blog/"] 
     77get_miniloops( array('title_url' => '/blog/'' ) );` 
     78 
     79**Number of Posts:** Number of posts to be displayed. Default: 3 
     80`[miniloop number_posts=3] 
     81get_miniloops( array('number_posts' => 3 ) );` 
     82 
     83**Post Offset:** Number of posts to skip before displaying the list. Default: 0 
     84`[miniloop post_offset=0] 
     85get_miniloops( array('post_offset' => 0 ) );` 
     86 
     87**Maximum Age:** Don't show posts more than X days old Default: 0 
     88`[miniloop maximum_age=0] 
     89get_miniloops( array('maximum_age' => 0 ) );` 
     90 
     91**Post Author:** Get author's post. By ID. Default: none 
     92`[miniloop post_author=0] 
     93get_miniloops( array('post_author' => 0 ) );` 
     94 
     95**Post Type:** Post type to display. Default: post 
     96`[miniloop post_type=post] 
     97get_miniloops( array('post_type' => 'post' ) );` 
     98 
     99**Post Status:** Post status to display. Primarily useful to show upcoming (future) posts. But be creative! Default: publish 
     100`[miniloop post_status=publish] 
     101get_miniloops( array('post_status' => 'publish' ) );` 
     102 
     103**Order By:** What order the posts should be displayed in. Default: date 
     104`[miniloop orderby=date] 
     105get_miniloops( array('orderby' => 'date' ) );` 
     106 
     107**Order:** Ascending (good for order by title) or Descending (good for order by date) Default: DESC 
     108`[miniloop order=DESC] 
     109get_miniloops( array('order' => 'DESC' ) );` 
     110 
     111**Meta Key for ordering:** If order by = meta value, specify a key. Default: none 
     112`[miniloop meta_value=some_key] 
     113get_miniloops( array('meta_value' => 'some_key' ) );` 
     114 
     115**Show posts in reverse order?** Perhaps you want the 3 most recent posts, but you want the oldest of those to be displayed first. If so, check this. Default: 0 
     116`[miniloop reverse_order=0] 
     117get_miniloops( array('reverse_order' => 0 ) );` 
     118 
     119**Shuffle post order?** Shuffle the order of the posts matching your query. Perhaps showing the 5 most recent posts in randomized order. Default: 0 
     120`[miniloop shuffle_order=0] 
     121get_miniloops( array('shuffle_order' => 0 ) );` 
     122 
     123**Ignore sticky posts?** Treat sticky posts as normal posts. I recommend ignoring, or the number of posts displayed may be inconsistent. Default: 1 
     124`[miniloop ignore_sticky=1] 
     125get_miniloops( array('ignore_sticky' => 1 ) );` 
     126 
     127**Exclude sticky posts?** Don't show sticky posts at all. Default: 0 
     128`[miniloop exclude_sticky=0] 
     129get_miniloops( array('exclude_sticky' => 0 ) );` 
     130 
     131**Only sticky posts?** Show only sticky posts. Default: 0 
     132`[miniloop only_sticky=0] 
     133get_miniloops( array('only_sticky' => 0 ) );` 
     134 
     135**If viewing a single post, exclude it?** If viewing a single post, remove it from the widget display. Default: 1 
     136`[miniloop exclude_current=1] 
     137get_miniloops( array('exclude_current' => 1 ) );` 
     138 
     139**Get posts from current category (if archive)?** If viewing an archive, only show posts from the same category. Default: 0 
     140`[miniloop current_category=1] 
     141get_miniloops( array('current_category' => 1 ) );` 
     142 
     143**Get posts from first category (if single)?** If viewing a single post, only show posts from the first category. Default: none 
     144`[miniloop current_single_category=1] 
     145get_miniloops( array('current_single_category' => 1 ) );` 
     146 
     147**Get posts from current author (if single or archive)?** Show more posts from the current author. Default: none 
     148`[miniloop current_author=1] 
     149get_miniloops( array('current_author' => 1 ) );` 
     150 
     151**Categories:** Comma separated list of category IDs to pull from. Use negative ID numbers to exclude a category. Default: none 
     152`[miniloop categories="1,8,13"] 
     153get_miniloops( array('categories' => '1,8,13' ) );` 
     154 
     155**Tags:** Comma separated list of tag IDs to pull from. Use negative ID numbers to exclude a tag. Default: none 
     156`[miniloop tags="15,40,88"] 
     157get_miniloops( array('tags' => '15,40,88' ) );` 
     158 
     159**Custom Taxonomies:** A clunky way to support custom taxonomies. Default: none. To include terms 5, 6, 9 from taxonomy "Genre" do this: 
     160`[miniloop tax="genre=5,6,9"] 
     161get_miniloops( array('tax' => 'genre=5,6,9' ) );` 
     162 
     163**Custom Fields:** For listing posts that have certain meta data. Default: none. To list posts that have a custom field 'favorite_color' with a value of 'blue' do this: 
     164`[miniloop custom_fields="favorite_color=blue"] 
     165get_miniloops( array('custom_fields' => 'favorite_color=blue' ) );` 
     166 
     167**Exclude Posts:** A comma separated list of post IDs to exclude. Default: none 
     168`[miniloop exclude="15,200,1032"] 
     169get_miniloops( array('exclude' => '15,200,1032' ) );` 
     170 
     171**Before Items:** Text/HTML to insert before the post list. Default: `<ul>` 
     172`[miniloop before_items="<div>"] 
     173get_miniloops( array('before_items' => '<div>' ) );` 
     174 
     175**After Items:** Text/HTML to insert after the post list. Default: `</ul>` 
     176`[miniloop after_items="</div>"] 
     177get_miniloops( array('after_items' => '</div>' ) );` 
    145178 
    146179**Item Format:** 
     
    317350Real image croping for thumbnails and several other new features. See Changelog. 
    318351 
    319 = Version 0.5 = 
    320  
    321352== Changelog == 
     353 
     354= Version 1.1.3 = 
     355* Fix: undefined index notice if zero posts match query 
     356* Fix: markup errors in widget. Corrects save issue regarding order 
     357* Fix: reset postdata instead of query 
     358* New: BETA - use `[ba_archive before='' after='']` shortcode to insert an author/taxonomy link. For use with before|after_items fields. 
    322359 
    323360= Version 1.1.2 = 
Note: See TracChangeset for help on using the changeset viewer.