php - Custom layouts for custom post types? (wordpress) -


i'm intending have few different custom post types want them have different layouts of normal posts.

normal posts have 2 different appearances themselves, 1 index page , 1 when click through permalink page.

for custom posts want same thing (two different layouts, both different normal posts) reason code doesn't seem making difference.

i've far used custom post template plugin tried code in post-[postype].php file, both seemed ineffective.

for single.php here's code -

<div id="primary" class="content-area">     <div id="content" class="site-content" role="main">      <?php while ( have_posts() ) : the_post(); ?> <!--- post wrapper home/post --->    <?php if ( is_home()) { echo '<div class="fullposthome">' ; }   else {  echo '<div class="fullpost">' ; } ?>  <?php if( get_post_meta($post->id, 'imgtest', true) ) { ?> <!--- made following div appear if said custom field presetn ----> <div class="testbox"><img src="<?php the_field('imgtest'); ?>" alt="" width="100%" height="auto"/></div> <!--- div custom field inside ---> <?php } ?>  <?php if ( is_home()) { echo '<div class="contenttextboxhome">' ; }   else {  echo '<div class="contenttextbox">' ; } ?>          <?php get_template_part( 'content', 'single' ); ?>  </div>            <?php temptheme1_content_nav( 'nav-below' ); ?>          <?php             // if comments open or have @ least 1 comment, load comment template             if ( comments_open() || '0' != get_comments_number() )                 comments_template();         ?>      <?php endwhile; // end of loop. ?>      </div><!-- #content -->  </div><!--- post wrapper --->  </div><!-- #primary --> 

for custom posts i've tried changing line custom posts tried i'm assuming names referencing [content/single.php] - in underscore.me / _s framework mind you, i'm going try on thematic framework since _s more bare bones easier me build how want it.

so question guess going wrong coding or how use custom post template plug in properly?

if custom post type "products"

then

  1. archive file should : archive-products.php
  2. taxonomy should : taxonomy-product_category_slug.php
  3. single file should : single-products.php

if want different content template then

create file of content-product.php

and in single.php use get_template_part( 'content', 'product' );

for current situation if working fine create content file, customize it.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -