WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: Meteor Slides] Random Slides from a Category

[Resolved] [Plugin: Meteor Slides] Random Slides from a Category

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Josh Leuze
    Participant

    @jleuze

    Hi, thanks for trying my plugin! I’m not sure I follow you exactly. So you have a slideshow with slide posts in it that is working, and you want to add blog posts to it from a certain category, is that right?

    You can use a custom slideshow template, and change the query for the slide loop to include slide and blog posts. But the category/slideshow taxonomies for that are going to be an issue.

    If you specify a category or slideshow, it will only get slide or blog posts in that category or slideshow, so you would need to have a taxonomy that was added to both the slide and blog post types. You can either extend categories or slideshows to cover both types, or create a new taxonomy that is added to both.

    Let me try to explain again. Since I use the same slideshow on every page, I am looking to randomize how it looks each time a page is loaded.

    My slideshow (hammondacademy.org) shows the images I have select in random order. That works great. What I would like is to have a pool of images that the slideshow would use only a few of at a time chosen randomly. So 30ish images are available, but each time the page is drawn, the slideshow just grabs 5 out of those 30 at random.

    I hope I was more clear this time.

    Plugin Author Josh Leuze
    Participant

    @jleuze

    Ah, that makes sense! There are two kinds of random when it comes to setting up the slideshow. The random that you are using right now via metadata is part of the slideshow script and randomizes only the latest slides that are being loaded, 5 or however many you set in the quantity.

    The other type of random you can use is in the WordPress post query, this will draw on all the slide posts, the 30ish you mention, and load 5 or however many you set at random.

    You can use this second type of random by using a custom slideshow template. Just update the WP_Query function and add an “orderby” parameter:

    $meteor_loop     = new WP_Query( array(
    
    		'post_type'      => 'slide',
    		'orderby'        => 'rand',
    		'slideshow'      => $slideshow,
    		'posts_per_page' => $meteor_options['slideshow_quantity']
    
    	) );

    Perfect! Thanks so much. Now I just need to start adding more pictures.

    Plugin Author Josh Leuze
    Participant

    @jleuze

    You’re welcome!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] [Plugin: Meteor Slides] Random Slides from a Category’ is closed to new replies.