Quantcast
Channel: Toolset » All Posts
Viewing all articles
Browse latest Browse all 20145

Reply To: Customize .php file per Type

$
0
0

Dear GeertK,
Thanks for the clarification. Are you sure you are creating the PHP templates correctly? We do have this tutorial that illustrates the very basic of creating a PHP template to display custom post type content: http://wp-types.com/documentation/user-guides/displaying-wordpress-custom-content/
Also WordPress Codex has this good tutorial on creating custom post type templates: http://codex.wordpress.org/Post_Types#Custom_Post_Type_Templates
Try reading the above tutorials and implemented its method on your local development server. The key is to have a proper PHP template file name that corresponds to your custom post type:

single-{post_type}.php

As will as to correctly query the content of the custom post type from the database using PHP, for example this code:

<?php 
 
//Define your custom post type name in the arguments
 
$args = array('post_type' => 'bios');
 
//Define the loop based on arguments
 
$loop = new WP_Query( $args );
 
//Display the contents
 
while ( $loop->have_posts() ) : $loop->the_post();
?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<div class="entry-content">
<?php the_content(); ?>
</div>
<?php endwhile;?>

Each types needs a specific PHP template. Try the above tips and let me know how it goes. Thanks.

Cheers,
Emerson


Viewing all articles
Browse latest Browse all 20145

Trending Articles