I've got (currently) 3 custom post types that I need to display on my sites' home page using a custom query. Each custom post type has a different layout (1 post across, 2 posts across and 4 posts across). What I am trying to do is call a different template for each layout.
I've been working on this close to a month and can't figure it out. Any help would be appreciated.
I'm using the following code, and it isn't working:
<?php
if ( 'one_column' == get_post_type() ) {
include 'inc-onecolumn.php';
} elseif ( 'two_column' == get_post_type() ) {
include 'inc-twocolumn.php';
} elseif ( 'four_column' == get_post_type() ) {
include 'inc-fourcolumn.php';
} else {
echo 'Hello!'
}
?>
I've created a couple of test posts but nothing is showing up on the homepage except 'Hello!'.
First, am I on the right path?
Second, if I am on the right path, is it the following code that's incorrect (it's my template for 1 across)?
Template code: http://pastebin.com/5iGiRFPF
ifs? And must you include the files, can't you query withget_postsfor one_column, display it, then query for two_column, display and so on. – Shane Feb 9 '12 at 19:44