Deprecated: Required parameter $location follows optional parameter $post_types in /home1/mybravet/public_html/wp-content/plugins/monarch/monarch.php on line 3783

Warning: session_start(): Session cannot be started after headers have already been sent in /home1/mybravet/public_html/wp-content/themes/Divi Child Theme/header.php on line 1
How to Use WordPress 3.0 Custom Post Types in Thesis | WordPress Developer Philippines How to Use WordPress 3.0 Custom Post Types in Thesis | WordPress Developer Philippines
Select Page
  • Facebook
  • Twitter
  • Google+
  • Pinterest

Image Source: DesignFaire.com

Now i’m going to be sharing how to implement custom post type in WordPress using your thesis theme. Though I was kind of hesitant to use custom post type since currently i’m doing fine with the default post type in WordPress and I get to organize my post using categories.

And to be honest I still don’t know when to use custom post type, so if you have some advice leave a comment below.

Let’s get down to business, first of all i’m not the original author of this tutorial just like everyone else I try researching and found two awesome tutorials and I have tested already so i’m sharing what works for me.

First is using a plugin called Custom Post Type UI

And the second option one is from ThomasGriffinMedia.com

Add this in your custom_functions.php

// Custom Post Type
function create_folio(){
$folio_args = array(
'label' => __('Folio'),
'singular_label' => __('Folio'),
'public' => true,
'show_ui' => true,
'capability_type' => 'post',
'hierarchical' => false,
'taxonomies' => array('post_tag','category'),
'rewrite' => array('slug' => 'folio','with_front' => false ),
'supports' => array('title','editor','thumbnail','custom-fields','comments','trackbacks','author')
);
register_post_type('folio',$folio_args);
}
add_action('init','create_folio');

Also add this in the custom_functions.php this piece of code will add thesis SEO boxes

/* BEGIN Adding Thesis Meta Boxes to ‘Folio’ */
 add_action('admin_menu','my_admin_menu');
 function my_admin_menu() {
 $post_options = new thesis_post_options;
 $post_options->meta_boxes();
 foreach ($post_options->meta_boxes as $meta_name => $meta_box)
 {
 add_meta_box($meta_box['id'], $meta_box['title'], array('thesis_post_options', 'output_' . $meta_name . '_box'),'folio','normal','high'); #wp
 }
 add_action('save_post', array('thesis_post_options','save_meta')); #wp
 }

In displaying or querying the post in your custom post type I use this, though you can implement what ever kind of query using WordPress codex for me the first line is what I need

<?php query_posts( array ( 'post_type'=> 'folio', 'post_per_page' => 3 ) );?>
<?php while (have_posts()) : the_post(); ?>
<p><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p>
<?php endwhile;?>

I think that is what you need. Now if you want to create another custom post type just changed all the folio text and replace it with the name of your custom post type that you want.

Detailed explanation on the second option

Pin It on Pinterest

Share This