Custom Image Thumbnails of Different Sizes

Add this code to your functions.php if(function_exists(‘add_theme_support’)) add_theme_support(‘post-thumbnails’); // Set the thumbnail size add_image_size(‘custom_logo’, 200, 200, true ); add_image_size(‘custom_website_thumb’, 450, 200, true ); add_image_size(‘custom_print_ad_thumb’, 200, 400, true ); Put this in your post template where you want to see the image. <?php echo get_the_post_thumbnail($post_id, ‘custom_logo’); ?> You can also wrap it in a link like … Read more

Custom post types instead of regular post’s categories in a page template

I believe the problem is how you are using this code: $args = array(‘post_type’ => array( ‘make’, ‘model’, ‘price’ ), ‘showposts’=>100, ‘orderby’=>’date’); $type_posts = new WP_Query($args); You may want to change it to something like this: $args = array(‘post_type’ => array( $post_type ), ‘showposts’=>100, ‘orderby’=>’date’); $type_posts = new WP_Query($args); So that it only grabs posts … Read more

Common categories for two custom post types

When you use register_taxonomy(), the second argument is the object_type argument, which accepts either a string or an array. You can pass this an array of objects to apply the taxonomy to, and it will be common between those. So, for example: array( ‘cpt_slug’, ‘post’ ) would give you a common taxonomy between cpt_slug and … Read more

How to create custom post listing in the admin?

This trick should help you… <?php add_action(‘pre_get_posts’, ‘filter_posts_list’); function filter_posts_list($query) { //$pagenow holds the name of the current page being viewed global $pagenow; $post_type = $query->get(‘post_type’); //Check the post type and whether its the list page, then set the taxonomy if($post_type == ‘my_cpt’ && ‘edit.php’ == $pagenow) { //global $query’s set() method for setting the … Read more

Custom Post Type as Home Page Problem

The error is in the code you added: function enable_front_page_stacks( $query ){ global $post, $wp_query; if(” == $query->query_vars[‘post_type’] && 0 != $query->query_vars[‘page_id’]) $query->set(‘post_type’, ‘wpwebinar’); } Specifically $query->set(). This call will specifically set the post type to “wpwebinar” if it’s not explicitly set to anything else. As a result, just hitting a regular page will force … Read more