WordPress.org

Ready to get started?Download WordPress

Forums

Ajax Post Carousel
Filtering by taxonomy (11 posts)

  1. cerupcat
    Member
    Posted 3 years ago #

    Great work on the new release; it's getting much better.

    Can you explain how to filter by taxonomy/tags? I'm not sure if I'm misunderstanding, if I'm doing this wrong or if this is a bug. I can't seem to get it to filter by default tag (post_tag) or custom taxonomy.

    Using the shortcode, i've tried:

    //custom taxonomy page
    $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );	
    
    echo do_shortcode('[apc-carousel visible_posts=3 init_posts=6 show_title=1 show_excerpt=0 loop=1 post_type=all '.$term->taxonomy.'='.$term->name.']');

    I have a custom taxonomy called 'authors'. The above would print something like 'authors=jim-collins' but nothing gets returned. Authors is the taxonomy 'slug' and 'jim-collins' is the term slug.

    I've also tried:

    echo do_shortcode('[apc-carousel visible_posts=3 init_posts=6 show_title=1 show_excerpt=0 loop=1 post_type=all tag=book]');

    This doesn't filter to show only posts with 'books' as the tag (default post_tag). Am I missing something?

    My goal is, if on a category page to show posts in those categories, if on a taxonomy/tag page to show posts with those taxonomy/tags, etc.

    Also, is it possible to choose multiple categories? Like category=category1&category2$category3 ?

    http://wordpress.org/extend/plugins/ajax-post-carousel/

  2. cerupcat
    Member
    Posted 3 years ago #

    Ok, I switched to using the php method instead of do_shortcode. I'm still testing, but this seems to be working so far if anyone is interested. This shows related category posts if on a category page or single page, related tag posts if on a tag page, and all posts if on none of the above.

    if ( is_single() ) {
    			$cats =  get_the_category();
    			$cat = $cats[0]; // let's just assume the post has one category
    			$cat_name = $cat->name;
    			echo Ajax_Post_Carousel::show_carousel(0, 3, 6, 1, 0, 1, 'all', ''.$cat->name.'');
    		}
    		else if(is_category()){
    			$cat = get_category( get_query_var( 'cat' ) );
    			echo Ajax_Post_Carousel::show_carousel(0, 3, 6, 1, 0, 1, 'all', ''.$cat->name.'');
    		}
    		else if(is_tag()){
    			$tag = get_query_var( 'tag' );
    			echo Ajax_Post_Carousel::show_carousel(0, 3, 6, 1, 0, 1, 'all', 'all', 'tag='.$tag.'');
    		}
    		else if(is_tax()){
    			$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
    			echo Ajax_Post_Carousel::show_carousel(0, 3, 6, 1, 0, 1, 'all', 'all', ''.$term->taxonomy.'='.$term->name.'');
    		}
    		else{
    			echo Ajax_Post_Carousel::show_carousel(0, 3, 6, 1, 0, 1, 'post', 'all');
    		}
  3. mantish
    Member
    Plugin Author

    Posted 3 years ago #

    Hi, thanks for trying out the plugin.

    So far filtering by tags is not supported. This is likely to be included in the next version.
    Filtering by multiple categories in not supported either, but we'll consider including this feature in future realeases.

    About your problem with the custom taxonomy, check what is being returned by get_term_by(). I think you should use $term->slug instead of $term->name

  4. dyrer
    Member
    Posted 3 years ago #

    hello
    i have a problem with excerpt
    when excerpt is enabled, posts are on each other and they dont rotate
    Am I doing somethin wrong?

  5. anabelle
    Member
    Plugin Author

    Posted 3 years ago #

    Do you have a live link where we can check?

  6. dyrer
    Member
    Posted 3 years ago #

  7. mantish
    Member
    Plugin Author

    Posted 3 years ago #

    You must set the width of .apc_item in your CSS.
    It is also recommended that you set the height.
    Also, the area where the carousel is inserted should be wide enough so all the items can fit horizontally

  8. sassysam
    Member
    Posted 3 years ago #


  9. nilesh.s
    Member
    Posted 3 years ago #

    hi, great working plugin. this is my first post.

    i wanted to know that how can i change the excerpt count...?

    thanks in advance.

  10. mantish
    Member
    Plugin Author

    Posted 3 years ago #

    Hi nilesh.
    I'm not sure if I understand you...you can choose whether to display the excerpts of the posts in the carousel. There's an option in the widget, as well as in the other methods.

  11. anabelle
    Member
    Plugin Author

    Posted 3 years ago #

    If you mean the length of the excerpt itself, you'd have to do it using another plugin or some function in your theme.

    This is outside the scope of our plugin.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic