WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: d13slideshow] parent category for post selection (4 posts)

  1. masterbassie
    Member
    Posted 5 years ago #

    I have a parent category entitled "Lessons" then under that i have sub categories. It doesn't seem to allow selection of the parent as "category to feature". Is this feasible?

    Also wondering if there is a way to increase the limit on shown pictures and a way to randomly select images. Such that when someone visits the page it randomly selects the pictures instead of being most recent.

    thanks for your help in advance.

    ian

  2. d13design
    Member
    Posted 5 years ago #

    Hi masterbassie,

    I'll look into both of these things for you.

    I'm using some pre-defined WP commands for the category dropdown so will need to read up on what's possible with this. I'll also looking at a "random" selection option and an extension to the 5 / 10 post limit.

    You can keep up to date on the plugin and updates at http://www.d13design.co.uk/wordpress/d13slideshow.

    Dave.

  3. masterbassie
    Member
    Posted 5 years ago #

    In my own impatience i devised a remedy (sort of). Only problem is I couldn't figure out how to print out all the array values parsed by a comma into the d13 php call. So i kinda improvised. Its a very down and dirty 'fix' for anyone who needs it.

    <?php
    $args = array(
    'numberposts' => 10,
    'category' => 8,
    'orderby' => rand
    );

    $lastposts = get_posts($args);
    foreach($lastposts as $post) :
    setup_postdata($post);
    ?>

    <?php
    $ID_Array[]=$post->ID;
    ?>
    <?php endforeach; ?>

    <?php d13slideshow(array($ID_Array[0], $ID_Array[1], $ID_Array[2], $ID_Array[3], $ID_Array[4], $ID_Array[5], $ID_Array[6], $ID_Array[7], $ID_Array[8], $ID_Array[9])); ?>

  4. jaysonbrown
    Member
    Posted 4 years ago #

    FYI, you can use masterbassie code in category.php, and have a slider preview dynamically for every category!

    <?php
    function getCurrentCategoryId()
    {
    	if (is_category()) {
    		global $wp_query;
    		$cat_obj = $wp_query->get_queried_object();
    		return $cat_obj->term_id;
    	}
    	return -1;
    }
    
    $args = array(
    
    'numberposts' => 3,
    
    'category' => getCurrentCategoryId(),
    
    'orderby' => rand
    
    );
    
    $lastposts = get_posts($args);
    
    foreach($lastposts as $post) :
    
    setup_postdata($post);
    
    ?>
    
    <?php
    
    $ID_Array[]=$post->ID;
    
    ?>
    
    <?php endforeach; ?>
    
    <?php d13slideshow(array($ID_Array[0], $ID_Array[1], $ID_Array[2], $ID_Array[3], $ID_Array[4], $ID_Array[5], $ID_Array[6], $ID_Array[7], $ID_Array[8], $ID_Array[9])); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic