• Hi there,
    I’m currently using a theme by WooThemes which has its own built-in “Popular Posts” widget. It’s awesome because you can show thumbnails instead of the post name. Kind of sidebar gallery!

    It’s working perfectly on one of my site because I’m using normal post type. But on another one, I’m using their own “woo type post” and the widget does not show anything (as I don’t have normal posts).
    How can I change the post type?

    Thanks in advance for your help.

    Maybe the below information can be useful:
    post_type = ‘woo_estate’
    ‘query_var’ => “woo_estate”,

    And here is the code:

    /*-----------------------------------------------------------------------------------*/
    /* WooTabs - Popular Posts */
    /*-----------------------------------------------------------------------------------*/
    
    function woo_tabs_popular( $posts = 5, $size = 35 ) {
    	$popular = new WP_Query('orderby=comment_count&posts_per_page='.$posts);
    	while ($popular->have_posts()) : $popular->the_post();
    ?>
    <li>
    	<?php if ($size <> 0) woo_get_image('image',$size,$size,'thumbnail',90,null,'src',1,0,'','',true,false,false); ?>
    	<a title="<?php the_title(); ?>" href="<?php the_permalink() ?>"><?php the_title(); ?></a>
    	<span class="meta"><?php the_time(get_option('date_format')); ?></span>
    	<div class="fix"></div>
    </li>
    <?php endwhile;
    }
    
    /*-----------------------------------------------------------------------------------*/
    /* WooTabs - Latest Posts */
    /*-----------------------------------------------------------------------------------*/
    
    function woo_tabs_latest( $posts = 5, $size = 35 ) {
    	$the_query = new WP_Query('showposts='. $posts .'&orderby=post_date&order=desc');
    	while ($the_query->have_posts()) : $the_query->the_post();
    ?>
    <li>
    	<?php if ($size <> 0) woo_get_image('image',$size,$size,'thumbnail',90,null,'src',1,0,'','',true,false,false); ?>
    	<a title="<?php the_title(); ?>" href="<?php the_permalink() ?>"><?php the_title(); ?></a>
    	<span class="meta"><?php the_time(get_option('date_format')); ?></span>
    	<div class="fix"></div>
    </li>
    <?php endwhile;
    }
Viewing 1 replies (of 1 total)
  • Thread Starter Nicolas Viallet

    (@royalcas)

    Hi again,

    Actually, I found a solution that works for me. I post it, in case it can help some of you.

    PS: I’m not a coder at all, so I do not guarantee it’s the proper code!

    I have changed

    $popular = new WP_Query('orderby=comment_count&posts_per_page='.$posts);

    to

    $popular = new WP_Query( array( 'post_type' => 'woo_estate','orderby=comment_count&posts_per_page='.$posts));

Viewing 1 replies (of 1 total)
  • The topic ‘Wootabs Widgets – Change post type’ is closed to new replies.