WordPress.org

Support

Support » Plugins and Hacks » Toolset Types » [Resolved] Displaying custom post types without the Views plugin

[Resolved] Displaying custom post types without the Views plugin

  • Balint Toth

    @tothbalint

    Hello!

    I really love the Types plugin because of it’s simplicity. I was thinking, is it possible to display the custom post types created with this plugin, in category, taxonomy listing pages and in single-post, but without the Views plugin? Because at this point I don’t want to pay for that.

    I have checked the Types plugin documentation, but everywhere I could see it mentions displaying custom post types, it mentions the Views plugin only…

    Any insights and help will be greatly appreciated!

    Thank you!
    Balint

    http://wordpress.org/plugins/types/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi Balint

    Of course, you can show your custom post types by raw PHP code. This is a sample code:

    $args = array( 'post_type' => 'product', 'posts_per_page' => 10 );
    $loop = new WP_Query( $args );
    
    echo '<div class="product-list">';
    while ( $loop->have_posts() ) : $loop->the_post();
    
    	if (has_post_thumbnail()) : ?>
    	<a class="thumb" href="<?php the_permalink() ?>" rel="bookmark"><?php the_post_thumbnail('full'); ?></a>
    	<?php else: ?>
    	<a class="thumb" href="<?php the_permalink() ?>" rel="bookmark">
    		<img src="<?php echo get_template_directory_uri().'/images/product-default-thumb.jpg'; ?>" />
    	</a>
    	<?php endif;
    
    	the_title();
    	echo '</div>';
    endwhile;
    echo '</div>';
    wp_reset_query();
    Balint Toth

    @tothbalint

    Thank you very much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Displaying custom post types without the Views plugin’ is closed to new replies.
Skip to toolbar