Mini Loops

35 thoughts on “Mini Loops”

  1. Hi,
    This is a very useful plugin. I hope you will develop it further. I also have some feature requests.

    Using category slugs, I use friendly links and there is no way in getting the category ID in a easy way in WP so using sulgs or names would speed up things drastically. There are a lot of wp functions that ca do this very easily.

    Some code examples for of short code expalaining how things work in when used in page or post. The “List category posts” has some good examples that are very clear when you start with the plugin.

    Thanks for the good work. This makes working with automatic menu’s in post and pages a lot easier.

  2. I am a novice when it comes to programming details but am hopeful you can provide me with direction for the following. I want to use your plugin to show posts on a page rather than as a widget within a sidebar. How do I go about doing that? Appreciate your kindness and patience. -James.

      1. I have the same question. I wasn't completely clear from viewing your documentation how to do this. Can I use miniloops to display posts on a page just as they would be displayed by default on WordPress? I'm trying to create a static homepage, but insert posts from the loop onto that page. If I wanted to display the three most recent posts with a specific category, what shortcode would I use? Something like?:

        [miniloops number_posts=10 categories=12]

        I say something like that, because I tried that and it didn't look anything like a normal post and the content spilled out of the content area into the sidebar. What am I doing wrong?

        1. To get the three most recent posts, you're on the right track, just make sure to specify 3, not 10.
          [miniloops number_posts=3 categories=12]

          However, Mini Loops will by default display everything in as an unordered list. This is probably not how your themes posts.

          I don't know exactly how your theme displays posts, but your adjustments might be something like this:

          Shortcode:

          [miniloop before_items='' after_items='' number_posts=3 categories=12][ml_format][/miniloop]

          On the same page, create a custom field called 'ml_format' with this value:

          <div class="entry [class]"><a href="[url]">[image from=customfield  
          cfname=image width=50 height=50 class=alignright  
          fallback='http://dummyimage.com/50'][title] 
          [excerpt wlength=30 space_between=1 after="..." after_link=1] 
          By [author] on [date format="n/j/y"]</div>
  3. Hi Kailey. I am using the mini loops plugin and its associated shortcode. Here is what I have:

    [miniloop categories=42 exclude=1696 number_posts=20 before_items= after_items=]{title}[/miniloop]

    This works! However, I have two questions:

    (1) Rather than using the exclude argument, I want to use tags in a conditional type scenario. Ideally, what I would like is:

    [miniloop categories=42 tags=active number_posts=20 before_items= after_items=]{title}[/miniloop]

    Where only posts that are from category 42 and have been assigned the tag active will show. Is this possible?

    (2) I am having difficulties making my list bulleted. My understanding is that the tag defines an unordered list (a bulleted list) however I am having difficulties getting the before_items and after_items arguments to work, assuming that is where my problem lies. Where should I be placing these arguments and how should they be formatted?

    Thank you so much for your assistance.
    James

  4. Hi, Loops Mini is an application that is still very useful to me,
    Thank you.
    Although I have a problem:
    When “w3c validation” errors with the alt property of the images.
    I can fix it how?.

    thanks

    Sorry for my English.

    1. Empty alt tags are now (version 0.9) being provided for W3C validation. In the future I may add an option that allows the alt tag to be customized.

  5. Love this plugin!
    I have deals I like to post on my blog but don’t want them to clutter my front page.
    I set up the plugin to show only the “deals” category and it works great! BUT when I use the WP Hide Post plugin to keep a post from showing on the front page, it also keeps it from showing in my mini loops side bar.

    Is there a way to force all posts in my specified category to show in the widget regardless of it showing on the front page?

    thanks so much for any help!

    1. Took a little investigating, but I think I’ve found a solution.

      You’ll need to edit the Mini Loops plugin, so using your favorite FTP client and text editor, find and open the helpers.php file in Mini Loops plugin folder (probably something like /wp-content/plugins/mini-loops/helpers.php).

      Find the line that reads $miniloop = new WP_Query( $query ); (line 114 in v0.8) and just above that add:

      remove_filter('posts_join_paged', 'wphp_query_posts_join');
      remove_filter('posts_where_paged', 'wphp_query_posts_where');

  6. This plugin are awesome! Thank you very much.
    However I have one problem: When I use shortcodes for image, WP returns this: “Catchable fatal error: Object of class WP_Error could not be converted to string in …pluginsmini-loopshelpers.php on line 550”.

    I tried “post”, “thumb”, “attached” and “first”, but the error persists.
    Thank you again.

    1. Thanks for catching that – I’ll look into it.

      In the meantime, you can add this line right above line 550 to stop the error:

      if( is_wp_error( $new ) ) return;

        1. I’m not sure if the latest version (0.9) will fix the problem you’re having, but give it a try and let me know if it does.

  7. Hello Kailey,

    First of all, thank you for an awesome plugin! Once the site I am building is up and running, I am definitely buying you a “cup of coffee” 🙂

    I was getting the same error as Apu (“Catchable fatal error…”) but only when trying to show the image from the custom field, while the ‘first’ attribute gave no errors and displayed the image placed inside the content without problems.

    On the other hand I have the following issue: the site I am building is multilingual (Catalan and Spanish) and I am quite satisfied with the qTranslate plugin. At first I just used the default post type and Mini Loops had no problem displaying a date-type custom field in its correct language. However, since I wanted a bit more of functionality, I used the “Custom Content Type Manager” plugin to create the “Activitats” custom post type with its own date-type custom field. Then I configured the “Custom Post View Generator” plugin to display the post with its date-type custom field and, as you can see, the date is displayed correctly localized: http://asac.adamfarkas.com/?post_type=activitats&p=357

    However, when I use Mini Loops to make a list, the date custom field is being displayed in English: http://asac.adamfarkas.com/activitats-asac/

    I am using the following shortcode:

    [miniloop post_type=activitats number_posts=20]
    Data: {field name=data}
    {title}
    {image from=first width=150 height=150 class=alignleft}
    {excerpt wlength=55 space_between=0}
    Lloc: {field name=lloc}
    Adreça: {field name=adreca}
    Hora: {field name=hora}
    Preu: {field name=preu}
    [/miniloop]

    I tried {field name=data format=”D, j F, Y”} to no avail… 🙁
    I would really prefer to use Mini Loops for listings as I love the straightforwardness if its item formating… Have any suggestions how to solve this problem? Thanks in advance and sorry for the long post!

    1. Thanks for the detailed report!

      I’m not terribly familiar with either qTranslate or “Custom Content Type Manager” so it might take me a bit to find a solution for you.

      Simply based on what you tried to do (“{field name=data format=”D, j F, Y”}”) you can try this:

      Find the miniloop_field() function in helpers.php (begins at line 305 in version 0.9) and replace it with this

      function miniloop_field( $atts ) {
      extract( shortcode_atts( array(
      'name' => '',
      'single' => 1,
      'separator' => ', ',
      'reverse' => 0,
      'format' => 0,
      ), $atts ) );
      if ( empty( $name ) ) return;

      if ( $single ) :
      $return = get_post_meta( get_the_ID(), $name, $single );
      else :
      $meta = get_post_meta( get_the_ID(), $name, $single );
      if ( $reverse ) $meta = array_reverse( $meta );
      $return = implode( $separator, $meta );
      endif;

      if ( $format )
      $return = date_i18n( $format, $return );

      return $return;
      }

  8. Hi and congratulations for this plugin.
    Sorry for this basic question but I would like to have the posts from the current category when I’m reading a single post. Is that possible ?
    In the widget I can see that : “Get posts from current category (if archive)?” Does it work only when you are reading a category but not a single post ?
    Thanks

    1. Install this slightly modified version. It includes an option to “Get posts from first category (if single)?”

      I’ll keep these changes in my working version so it’ll be compatible with the next release.

      1. youyou ! It works. Tks a lot for your fast answer.
        I will install your plugin on my different websites.
        See you

        1. 🙂 You forgot the “Get posts from first category (if single)?” in the last release no ?

          Cheers and tks again for your work

  9. Is there a way to add the category name to the “Title” field of the widget? It would be the same as when using “Get posts from first category (if single)?” option.

    So instead of having a header like “Recent Posts” it would appear “Recent – Cat A”

    Tried to search this portion of the code, but not familiar with PHP and WP programming…even if you just point out where to change would be appreciated.

    1. You can add [category] to Before Item with additional markup and tick the Hide Title checkbox. This will “fake” a normal widget title.

      1. Thanks.
        Does the easy input options, with fields, exist ? (the one that you see in the photo)

        Or do I have to understand all this code?

    1. Same here.
      Does mini loops support pagination? It would be an awesome feature to have in the next update.

  10. I’m using this code and it works on all pages except my static homepage. I’ve tried to narrow down the conflict without much success. On the homepage it shows nothing. Any idea what I can do? Shortcodes for other plugins work.


    [miniloop number_posts=1][ml_format][/miniloop]

    Here is my custom field, ml_format

    [ml_title]
    [ml_excerpt wlength=40 after="..." after_link=0] Read the rest of this entry

  11. Hi,
    First of all, congrats for developing such a useful widget and thank you.

    [miniloop tags=”-28″ number_posts=2 before_items=” after_items=”]

    I have a problem here. I want to show 2 any post except tag 28. But as I see, it doesn’t recognizes this and shows posts tagged with 28 (since I used the negative letter ‘-‘ in front of the id if the tag, it should do the exact opposite I assume)

    What am I doing wrong here? How can I fix this?

    Thank you again.

  12. I would like to do something really simple. I’d like to have 3 mini loops widgets, each widget would display content from one particular page.

    I have the item format set to [ml_content]; Number of posts to 1; post type to pages…

    “Order by” wouldn’t be as much of a factor since I only want 1 page to display in the mini loops widget – but can I use Order by to identify the specific page I would like to display in the mini loop widget?

    So basically how do I identify the page I want to display in the mini loop widget?

    I’ve tried date, but that only works for so long until you create another page? I’ve tried ID but that wasn’t working in any of the ID fields within mini loop widget.

    Any help would be greatly appreciated!
    Thank you.
    _Cindy

Comments are closed.

Please use this plugin's WordPress.org support forum if you need assistance.