Hello Friends !!
Today, wordpress is widely used opensource. And in wordpress 3.0 and later versions, there are many new features which are not in later versions.
Yes, today I will share with you one new feature . Do you know How you can add new custom post section in wordpress ?
Understand what I mean ? Ok, dont take tension. I will show you want I mean and what i want to share with you. Please see image :
See above image. In this, I have added two new section Deals and Podcast. I am going to share with you that how can you make this ?
First of all, open post.php file which it located in wp-include folder.
After that find function create_initial_post_types() and place below code in this function :
‘label’ => __(‘Podcast’),
‘singular_label’ => __(‘Podcast’),
‘public’ => true,
‘show_ui’ => true,
‘capability_type’ => ‘post’,
‘hierarchical’ => false,
‘rewrite’ => false,
‘query_var’ => false,
‘supports’ => array( ‘title’, ‘editor’, ‘thumbnail’, ‘excerpt’, ‘custom-fields’ )
more details, click below :
Above code registers new custom post type podcast in your admin. You can see it in your admin. For insert posts in this section, place below code after completion function create_initial_post_types().
$columns = array(
“cb” => “<input type=\”checkbox\” />”,
“title” => “Podcast Title”,
“description” => “Description”,
“length” => “Length”,
“speakers” => “Speakers”,
“comments” => ‘Comments’
if (“ID” == $column) echo $post->ID;
elseif (“description” == $column) echo $post->post_content;
elseif (“length” == $column) echo “63:50″;
elseif (“speakers” == $column) echo “admin”;
Now you can add posts in this new section. Enjoy this new magic. But one question will be in your mind that how can i display these posts in front end ? Am I right ? Don’t worry. I also give you the code by which you can list these posts in front end. Just copy paste below code where you want to display losts in front end:
while ( $loop->have_posts() ) : $loop->the_post();
Thats it !! If you like this post or if you have any query in wordpress on in PHP, feel free to comment me or contact me.