Title: Custom Post Types
Last modified: July 31, 2020

---

# Custom Post Types

 *  Resolved [erismarcds](https://wordpress.org/support/users/tom2/)
 * (@tom2)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/custom-post-types-383/)
 * Hello, I would like to use custom posts, I tried something like this, but it 
   doesn’t work, can you help me? I thank you, great plugin
 *     ```
       <?php
       global $post;
   
       $posts = wpp_get_mostpopular( array(
          'limit'     => 10,
          'post_type' => 'post',
          'range'     => 'last24hours',
       ) );
   
       echo '<ul>';
   
       if ( count( $posts ) > 0 ):
          foreach ( $posts as $the_post ):
             setup_postdata( $the_post );
       ?>
   
          <li><a href="<?php the_permalink() ?>" title="<?php echo esc_attr( get_the_title() ); ?>"><?php the_title(); ?></a></li>
   
       <?php
          endforeach;
       endif;
   
       echo '</ul>';
   
       wp_reset_postdata();
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/custom-post-types-383/#post-13195852)
 * Hi [@tom2](https://wordpress.org/support/users/tom2/),
 * All you need to do is pass your custom post type to the _post\_type_ parameter,
   like this for example:
 *     ```
       <?php
       $args = array(
           'post_type' => 'post, page, your-custom-post-type-here' // comma separated
       );
   
       wpp_get_mostpopular($args);
       ?>
       ```
   
 *  Thread Starter [erismarcds](https://wordpress.org/support/users/tom2/)
 * (@tom2)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/custom-post-types-383/#post-13195944)
 * I would like to add thumbnail and manual title, but it shows what comes in the
   plug-in ‘<ul class = “wpp-list”>’, if you want to send my site, I don’t know 
   much about PHP. Pardon my English.
 *     ```
       <?php
       $args = array(
           'post_type' => 'post, page, <div class="img" style="background-image:url(<?php echo get_the_post_thumbnail_url( $post_id, 'large' ); ?>);">	</div>' // comma separated
       );
   
       wpp_get_mostpopular($args);
       ?>
       ```
   
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/custom-post-types-383/#post-13196183)
 * Alright, try this:
 *     ```
       <?php
       $args = array(
           'limit' => 10,
           'range' => 'last24hours',
           'post_type' => 'your-custom-post-type-here',
           'thumbnail_width' => 100,
           'thumbnail_height' = 100,
           'post_html' => '<div class="img" style="background-image:url({thumb_url});">Your Custom Title Here (eg. {text_title})</div>'
       );
       wpp_get_mostpopular($args);
       ?>
       ```
   
 * Things you need to change:
    - The width & height of the background image (see _thumbnail\_width_ and _thumbnail\
      _height_).
    - The name of your custom post type (see _post\_type_).
    - The actual HTML structure of each of your popular posts (see _post\_html_)
 * Friendly advice: you should consider spending some more time learning PHP and
   WordPress Development in general if you want to code stuff on your own. Alternatively,
   hiring a more experience developer is also an option if you don’t have time to
   learn (eg. you have a deadline ahead.)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Custom Post Types’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-popular-posts/assets/icon-256x256.png?rev=1232659)
 * [WP Popular Posts](https://wordpress.org/plugins/wordpress-popular-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-popular-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-popular-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-popular-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-popular-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-popular-posts/reviews/)

## Tags

 * [cpt](https://wordpress.org/support/topic-tag/cpt/)

 * 3 replies
 * 2 participants
 * Last reply from: [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * Last activity: [5 years, 9 months ago](https://wordpress.org/support/topic/custom-post-types-383/#post-13196183)
 * Status: resolved