WordPress.org

Ready to get started?Download WordPress

Forums

Types - Custom Fields and Custom Post Types Management
[resolved] Displaying custom post types without the Views plugin (3 posts)

  1. Noone Here
    Member
    Posted 8 months ago #

    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/

  2. Hesam Bahrami (Genzo)
    Member
    Posted 8 months ago #

    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();
  3. Noone Here
    Member
    Posted 8 months ago #

    Thank you very much!

Reply

You must log in to post.

About this Plugin

About this Topic