Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Allow pages to display custom post type WordPress

  • REFUNDED

I have downloaded a plugin that creates custom post. Name of plugin: Custom Post Type UI.

My theme: http://themeforest.net/item/jarida-responsive-wordpress-news-magazine-blog/4309191

----

When I create a Page, it gives me the option for "Blog List Template Options - Categories" and I get to choose a categorie I want the page to display but my only problem is it wont display any custom post types.

My main goal is to be able to have a Page as a "Parent" of a custom post type.

When I asked the author of the theme, he told me that :

-This is a change you would have to make on your own by make modifications on template-blog.php and panel/post-options.php as it is not an automatic feature of the theme.

Post-Options.php:
<?php
add_action("admin_init", "posts_init");
function posts_init(){
add_meta_box("post_options", theme_name ." - Post Options", "post_options", "post", "normal", "high");
add_meta_box("page_options", theme_name ." - Page Options", "page_options", "page", "normal", "high");
}

function post_options(){
global $post ;
$get_meta = get_post_custom($post->ID);

if(isset($get_meta["tie_sidebar_pos"][0]))
$tie_sidebar_pos = $get_meta["tie_sidebar_pos"][0];

if(isset( $get_meta["tie_review_criteria"][0] ))
$tie_review_criteria = unserialize($get_meta["tie_review_criteria"][0]);

wp_enqueue_script( 'tie-admin-slider' );

?>
<div class="tiepanel-item">
<input type="hidden" name="tie_hidden_flag" value="true" />

<h3>Review Post Options</h3>
<?php

tie_post_options(
array( "name" => "Review Box Position",
"id" => "tie_review_position",
"type" => "select",
"options" => array( "" => "Disable" ,
"top" => "Top of the post" ,
"bottom" => "Bottom of the post",
"both" => "Top and Bottom of the post",
"custom" => "Custom position")));
?>
<div id="reviews-options">
<?php
tie_post_options(
array( "name" => "Review Style",
"id" => "tie_review_style",
"type" => "select",
"options" => array( "stars" => "Stars" ,
"percentage" => "Percentage",
"points" => "Points")));

tie_post_options(
array( "name" => "Review Summary",
"id" => "tie_review_summary",
"type" => "textarea"));

tie_post_options(
array( "name" => "Text appears under the total score",
"id" => "tie_review_total",
"type" => "text"));

?>
<?php for($i=1 ; $i<=10 ; $i++ ){ ?>

<div class="option-item review-item">
<span class="label">Review Criteria <?php echo $i ?></span>
<input name="tie_review_criteria[<?php echo $i ?>][name]" type="text" value="<?php if( !empty($tie_review_criteria[$i]['name'] ) ) echo $tie_review_criteria[$i]['name'] ?>" />
<div class="clear"></div>
<span class="label">Criteria Score <?php echo $i ?></span>
<div id="criteria<?php echo $i ?>-slider"></div>
<input type="text" id="criteria<?php echo $i ?>" value="<?php if( !empty($tie_review_criteria[$i]['score']) ) echo $tie_review_criteria[$i]['score']; else echo 0; ?>" name="tie_review_criteria[<?php echo $i ?>][score]" style="width:50px; opacity: 0.7;" />
<script>
jQuery(document).ready(function() {
jQuery("#criteria<?php echo $i ?>-slider").slider({
range: "min",
min: 0,
max: 100,
value: <?php if( !empty($tie_review_criteria[$i]['score']) ) echo $tie_review_criteria[$i]['score']; else echo 0; ?>,
slide: function(event, ui) {
jQuery('#criteria<?php echo $i ?>').attr('value', ui.value );
}
});
});
</script>
</div>

<?php
}
?>
</div>
</div>

<div class="tiepanel-item">
<h3>General Options</h3>
<?php

tie_post_options(
array( "name" => "Hide Post Meta",
"id" => "tie_hide_meta",
"type" => "select",
"options" => array( "" => "" ,
"yes" => "Yes" ,
"no" => "No")));

tie_post_options(
array( "name" => "Hide Author Information",
"id" => "tie_hide_author",
"type" => "select",
"options" => array( "" => "" ,
"yes" => "Yes" ,
"no" => "No")));

tie_post_options(
array( "name" => "Hide Share Buttons",
"id" => "tie_hide_share",
"type" => "select",
"options" => array( "" => "" ,
"yes" => "Yes" ,
"no" => "No")));

tie_post_options(
array( "name" => "Hide Related Posts",
"id" => "tie_hide_related",
"type" => "select",
"options" => array( "" => "" ,
"yes" => "Yes" ,
"no" => "No")));
?>
</div>

<div class="tiepanel-item">
<h3>Sidebar Options</h3>
<div class="option-item">
<?php
$checked = 'checked="checked"';
?>
<ul id="sidebar-position-options" class="tie-options sidebar-position-options2">
<li>
<input id="tie_sidebar_pos" name="tie_sidebar_pos" type="radio" value="default" <?php if( ( isset($tie_sidebar_pos) && $tie_sidebar_pos == 'default' ) || empty($tie_sidebar_pos) ) echo $checked; ?> />
<a class="checkbox-select" href="#"><img src="<?php echo get_template_directory_uri(); ?>/panel/images/sidebar-default.png" /></a>
</li> <li>
<input id="tie_sidebar_pos" name="tie_sidebar_pos" type="radio" value="right" <?php if( ( isset($tie_sidebar_pos) && $tie_sidebar_pos == 'right' ) ) echo $checked; ?> />
<a class="checkbox-select" href="#"><img src="<?php echo get_template_directory_uri(); ?>/panel/images/sidebar-right.png" /></a>
</li>
<li>
<input id="tie_sidebar_pos" name="tie_sidebar_pos" type="radio" value="left" <?php if( ( isset($tie_sidebar_pos) && $tie_sidebar_pos == 'left') ) echo $checked; ?> />
<a class="checkbox-select" href="#"><img src="<?php echo get_template_directory_uri(); ?>/panel/images/sidebar-left.png" /></a>
</li>
<li>
<input id="tie_sidebar_pos" name="tie_sidebar_pos" type="radio" value="nright" <?php if( ( isset($tie_sidebar_pos) && $tie_sidebar_pos == 'nright') ) echo $checked; ?> />
<a class="checkbox-select" href="#"><img src="<?php echo get_template_directory_uri(); ?>/panel/images/sidebar-1.png" /></a>
</li>
<li>
<input id="tie_sidebar_pos" name="tie_sidebar_pos" type="radio" value="nleft" <?php if( ( isset($tie_sidebar_pos) && $tie_sidebar_pos == 'nleft') ) echo $checked; ?> />
<a class="checkbox-select" href="#"><img src="<?php echo get_template_directory_uri(); ?>/panel/images/sidebar-2.png" /></a>
</li>
<li>
<input id="tie_sidebar_pos" name="tie_sidebar_pos" type="radio" value="full" <?php if( ( isset($tie_sidebar_pos) && $tie_sidebar_pos == 'full') ) echo $checked; ?> />
<a class="checkbox-select" href="#"><img src="<?php echo get_template_directory_uri(); ?>/panel/images/sidebar-no.png" /></a>
</li>
</ul>
</div>
<?php
$sidebars = tie_get_option( 'sidebars' ) ;
$new_sidebars = array(''=> 'Default');
if($sidebars){
foreach ($sidebars as $sidebar) {
$new_sidebars[$sidebar] = $sidebar;
}
}

tie_post_options(
array( "name" => "Choose Sidebar",
"id" => "tie_sidebar_post",
"type" => "select",
"options" => $new_sidebars ));

if(tie_get_option( 'columns_num' ) != '2c'){
tie_post_options(
array( "name" => "Choose Narrow Sidebar",
"id" => "tie_sidebar_narrow_post",
"type" => "select",
"options" => $new_sidebars ));
}
?>
</div>


<div class="tiepanel-item">
<h3>Post Head Options</h3>
<?php

tie_post_options(
array( "name" => "Display",
"id" => "tie_post_head",
"type" => "select",
"options" => array(
''=> 'Default',
'none'=> 'None',
'video'=> 'Video',
'audio'=> 'Audio - Self Hosted',
'soundcloud'=> 'Audio - SoundCloud',
'slider'=> 'Slider',
'map'=> 'Google Map',
'thumb'=> 'Featured Image',
'lightbox'=> 'Featured Image + lightbox'
)));


tie_post_options(
array( "name" => "Embed Code",
"id" => "tie_embed_code",
"type" => "textarea"));

tie_post_options(
array( "name" => "Youtube / Vimeo / Dailymotion Video Url",
"id" => "tie_video_url",
"type" => "text"));

tie_post_options(
array( "name" => "SoundCloud URL",
"id" => "tie_audio_soundcloud",
"type" => "text"));

tie_post_options(
array( "name" => "Auto Play",
"id" => "tie_audio_soundcloud_play",
"type" => "checkbox"));

tie_post_options(
array( "name" => "Mp3 file Url <strong><small>(required)</small></strong>",
"id" => "tie_audio_mp3",
"type" => "text"));

tie_post_options(
array( "name" => "M4A file Url",
"id" => "tie_audio_m4a",
"type" => "text"));

tie_post_options(
array( "name" => "OGA file Url <strong><small>(required)</small></strong>",
"id" => "tie_audio_oga",
"type" => "text"));

global $post;
$orig_post = $post;

$sliders = array();
$custom_slider = new WP_Query( array( 'post_type' => 'tie_slider', 'posts_per_page' => -1 ) );
while ( $custom_slider->have_posts() ) {
$custom_slider->the_post();
$sliders[get_the_ID()] = get_the_title();
}
$post = $orig_post;
wp_reset_query();

tie_post_options(
array( "name" => "Custom Slider",
"id" => "tie_post_slider",
"type" => "select",
"options" => $sliders ));

tie_post_options(
array( "name" => "Google Map Url",
"id" => "tie_googlemap_url",
"type" => "text"));

?>
</div>

<div class="tiepanel-item">
<h3>Banners Options</h3>
<?php
tie_post_options(
array( "name" => "Hide Above Banner",
"id" => "tie_hide_above",
"type" => "checkbox"));

tie_post_options(
array( "name" => "Custom Above Banner",
"id" => "tie_banner_above",
"type" => "textarea"));

tie_post_options(
array( "name" => "Hide Below Banner",
"id" => "tie_hide_below",
"type" => "checkbox"));

tie_post_options(
array( "name" => "Custom Below Banner",
"id" => "tie_banner_below",
"type" => "textarea"));
?>
</div>
<?php
}

/*********************************************************************************************/

function page_options(){
global $post ;
$get_meta = get_post_custom($post->ID);
if(isset($get_meta["tie_sidebar_pos"][0]))
$tie_sidebar_pos = $get_meta["tie_sidebar_pos"][0];

$categories_obj = get_categories();
$categories = array();
$categories = array(''=> 'All Categories');
foreach ($categories_obj as $pn_cat) {
$categories[$pn_cat->cat_ID] = $pn_cat->cat_name;
}

?>
<input type="hidden" name="tie_hidden_flag" value="true" />

<div class="tiepanel-item">
<h3>Sidebar Options</h3>
<div class="option-item">
<?php
$checked = 'checked="checked"';
?>
<ul id="sidebar-position-options" class="tie-options">
<li>
<input id="tie_sidebar_pos" name="tie_sidebar_pos" type="radio" value="default" <?php if(isset($tie_sidebar_pos) && $tie_sidebar_pos == 'default' || !isset($tie_sidebar_pos) ) echo $checked; ?> />
<a class="checkbox-select" href="#"><img src="<?php echo get_template_directory_uri(); ?>/panel/images/sidebar-default.png" /></a>
</li> <li>
<input id="tie_sidebar_pos" name="tie_sidebar_pos" type="radio" value="right" <?php if( isset($tie_sidebar_pos) && $tie_sidebar_pos == 'right' ) echo $checked; ?> />
<a class="checkbox-select" href="#"><img src="<?php echo get_template_directory_uri(); ?>/panel/images/sidebar-right.png" /></a>
</li>
<li>
<input id="tie_sidebar_pos" name="tie_sidebar_pos" type="radio" value="left" <?php if( isset($tie_sidebar_pos) && $tie_sidebar_pos == 'left') echo $checked; ?> />
<a class="checkbox-select" href="#"><img src="<?php echo get_template_directory_uri(); ?>/panel/images/sidebar-left.png" /></a>
</li>
<li>
<input id="tie_sidebar_pos" name="tie_sidebar_pos" type="radio" value="full" <?php if( isset($tie_sidebar_pos) && $tie_sidebar_pos == 'full') echo $checked; ?> />
<a class="checkbox-select" href="#"><img src="<?php echo get_template_directory_uri(); ?>/panel/images/sidebar-no.png" /></a>
</li>
</ul>
</div>
<?php
$sidebars = tie_get_option( 'sidebars' ) ;
$new_sidebars = array(''=> 'Default');
if($sidebars){
foreach ($sidebars as $sidebar) {
$new_sidebars[$sidebar] = $sidebar;
}
}

tie_post_options(
array( "name" => "Choose Sidebar",
"id" => "tie_sidebar_post",
"type" => "select",
"options" => $new_sidebars ));

if(tie_get_option( 'columns_num' ) != '2c'){
tie_post_options(
array( "name" => "Choose Narrow Sidebar",
"id" => "tie_sidebar_narrow_post",
"type" => "select",
"options" => $new_sidebars ));
}
?>
</div>

<div class="tiepanel-item">
<h3>Post Head Options</h3>
<?php

tie_post_options(
array( "name" => "Display",
"id" => "tie_post_head",
"type" => "select",
"options" => array(
''=> 'Default',
'none'=> 'None',
'video'=> 'Video',
'audio'=> 'Audio - Self Hosted',
'soundcloud'=> 'Audio - SoundCloud',
'slider'=> 'Slider',
'map'=> 'Google Map',
'thumb'=> 'Featured Image',
'lightbox'=> 'Featured Image + lightbox'
)));


tie_post_options(
array( "name" => "Embed Code",
"id" => "tie_embed_code",
"type" => "textarea"));

tie_post_options(
array( "name" => "Youtube / Vimeo Video Url",
"id" => "tie_video_url",
"type" => "text"));

tie_post_options(
array( "name" => "SoundCloud URL",
"id" => "tie_audio_soundcloud",
"type" => "text"));

tie_post_options(
array( "name" => "Auto Play",
"id" => "tie_audio_soundcloud_play",
"type" => "checkbox"));

tie_post_options(
array( "name" => "Mp3 file Url <strong><small>(required)</small></strong>",
"id" => "tie_audio_mp3",
"type" => "text"));

tie_post_options(
array( "name" => "M4A file Url",
"id" => "tie_audio_m4a",
"type" => "text"));

tie_post_options(
array( "name" => "OGA file Url <strong><small>(required)</small></strong>",
"id" => "tie_audio_oga",
"type" => "text"));


global $post;
$orig_post = $post;

$sliders = array();
$custom_slider = new WP_Query( array( 'post_type' => 'tie_slider', 'posts_per_page' => -1 ) );
while ( $custom_slider->have_posts() ) {
$custom_slider->the_post();
$sliders[get_the_ID()] = get_the_title();
}
$post = $orig_post;
wp_reset_query();

tie_post_options(
array( "name" => "Custom Slider",
"id" => "tie_post_slider",
"type" => "select",
"options" => $sliders ));


tie_post_options(
array( "name" => "Google Map Url",
"id" => "tie_googlemap_url",
"type" => "text"));
?>
</div>

<div class="tiepanel-item">
<h3>Banners Options</h3>
<?php
tie_post_options(
array( "name" => "Hide Above Banner",
"id" => "tie_hide_above",
"type" => "checkbox"));

tie_post_options(
array( "name" => "Custom Above Banner",
"id" => "tie_banner_above",
"type" => "textarea"));

tie_post_options(
array( "name" => "Hide Below Banner",
"id" => "tie_hide_below",
"type" => "checkbox"));

tie_post_options(
array( "name" => "Custom Below Banner",
"id" => "tie_banner_below",
"type" => "textarea"));
?>
</div>


<div class="tiepanel-item">
<h3>Blog List template Options</h3>
<?php
tie_post_options(
array( "name" => "Categories",
"id" => "tie_blog_cats",
"type" => "select",
"options" => $categories ));
?>
</div>
<?php
}

add_action('save_post', 'save_post');
function save_post( $post_id ){
global $post;

if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
return $post_id;

if (isset($_POST['tie_hidden_flag'])) {

$custom_meta_fields = array(
'tie_blog_cats',
'tie_hide_meta',
'tie_hide_author',
'tie_hide_share',
'tie_hide_related',
'tie_sidebar_pos',
'tie_sidebar_post',
'tie_sidebar_narrow_post',
'tie_post_head',
'tie_post_slider',
'tie_googlemap_url',
'tie_video_url',
'tie_embed_code',
'tie_audio_m4a',
'tie_audio_mp3',
'tie_audio_oga',
'tie_audio_soundcloud',
'tie_audio_soundcloud_play',
'tie_hide_above',
'tie_banner_above',
'tie_hide_below',
'tie_banner_below',
'tie_review_position',
'tie_review_style',
'tie_review_summary',
'tie_review_total');

foreach( $custom_meta_fields as $custom_meta_field ){
if(isset($_POST[$custom_meta_field]) )
update_post_meta($post_id, $custom_meta_field, htmlspecialchars(stripslashes($_POST[$custom_meta_field])) );
else
delete_post_meta($post_id, $custom_meta_field);
}

if( isset($_POST['tie_review_criteria']) )
update_post_meta($post_id, 'tie_review_criteria', $_POST['tie_review_criteria']);

$get_meta = get_post_custom($post_id);

$total_counter = $score = 0;
if( isset( $get_meta['tie_review_criteria'][0] ))
$criterias = unserialize( $get_meta['tie_review_criteria'][0] );

if( !empty($criterias) ){
foreach( $criterias as $criteria){
if( $criteria['name'] && $criteria['score'] && is_numeric( $criteria['score'] )){
if( $criteria['score'] > 100 ) $criteria['score'] = 100;
if( $criteria['score'] < 0 ) $criteria['score'] = 1;

$score += $criteria['score'];
$total_counter ++;
}
}
if( !empty( $score ) && !empty( $total_counter ) )
$total_score = $score / $total_counter ;

update_post_meta($post_id, 'tie_review_score', $total_score);
}
}
}




/*********************************************************/

function tie_post_options($value){
global $post;
?>

<div class="option-item" id="<?php echo $value['id'] ?>-item">
<span class="label"><?php echo $value['name']; ?></span>
<?php
$id = $value['id'];
$get_meta = get_post_custom($post->ID);


if( isset( $get_meta[$id][0] ) )
$current_value = $get_meta[$id][0];

switch ( $value['type'] ) {

case 'text': ?>
<input name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="text" value="<?php if( !empty( $current_value ) ) echo $current_value ?>" />
<?php
break;

case 'checkbox':
if( !empty( $current_value ) ){$checked = "checked=\"checked\""; } else{$checked = "";} ?>
<input type="checkbox" name="<?php echo $value['id'] ?>" id="<?php echo $value['id'] ?>" value="true" <?php echo $checked; ?> />
<?php
break;

case 'select':
?>
<select name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>">
<?php foreach ($value['options'] as $key => $option) { ?>
<option value="<?php echo $key ?>" <?php if ( isset($current_value) && $current_value == $key) { echo ' selected="selected"' ; } ?>><?php echo $option; ?></option>
<?php } ?>
</select>
<?php
break;

case 'textarea':
?>
<textarea style="direction:ltr; text-align:left; width:430px;" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="textarea" cols="100%" rows="3" tabindex="4"><?php if( !empty( $current_value ) ) echo $current_value ?></textarea>
<?php
break;
} ?>
</div>
<?php
}
?>


Template-Blog.php

<?php
/*
Template Name: Blog List
*/
?>
<?php get_header(); ?>
<div class="content-wrap">
<div class="content">
<?php tie_breadcrumbs() ?>

<?php if ( ! have_posts() ) : ?>
<div id="post-0" class="post not-found post-listing">
<h1 class="post-title"><?php _e( 'Not Found', 'tie' ); ?></h1>
<div class="entry">
<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'tie' ); ?></p>
<?php get_search_form(); ?>
</div>
</div>
<?php endif; ?>

<div class="page-head">
<h1 class="page-title">
<?php the_title(); ?>
</h1>
</div>

<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<?php $get_meta = get_post_custom($post->ID); ?>
<?php tie_include( 'post-head' ); // Get Post Head template ?>
<div class="entry"><?php the_content(); ?></div>
<?php endwhile; ?>

<?php //Above Post Banner
if( empty( $get_meta["tie_hide_above"][0] ) ){
if( !empty( $get_meta["tie_banner_above"][0] ) ) echo '<div class="ads-post">' .htmlspecialchars_decode($get_meta["tie_banner_above"][0]) .'</div>';
else tie_banner('banner_above' , '<div class="ads-post">' , '</div>' );
}
?>

<?php $cat_query = '';
if ( !empty( $get_meta["tie_blog_cats"][0] ) ) $cat_query = '&cat=' . $get_meta["tie_blog_cats"][0] ; ?>
<?php query_posts('paged='.$paged.'&posts_per_page='. $cat_query); ?>
<?php get_template_part( 'loop', 'category' ); ?>
<?php if ($wp_query->max_num_pages > 1) tie_pagenavi(); ?>

<?php //Below Post Banner
if( empty( $get_meta["tie_hide_below"][0] ) ){
if( !empty( $get_meta["tie_banner_below"][0] ) ) echo '<div class="ads-post">' .htmlspecialchars_decode($get_meta["tie_banner_below"][0]) .'</div>';
else tie_banner('banner_below' , '<div class="ads-post">' , '</div>' );
}
?>

<?php comments_template( '', true ); ?>
</div><!-- .content -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>

Answers (2)

2013-05-09

Daniel Yoen answers:

hello,

in "Template-Blog.php", try to add :

<?php query_posts('post_type' => 'your-post-type-name-here'); ?>

above :

<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>

hope this help :-)


GDC-Linux comments:

No luck =/

It breaks the page saying it may be down for maintenance or configured incorrectly.


Daniel Yoen comments:

Owh I am really sorry, should be like this :

<?php query_posts(array('post_type' => 'your-post-type-name-here')); ?>

:-)


Daniel Yoen comments:

Hello, to get category for your custom post type :

In "Post-Options.php" :

$categories_obj = get_categories();

replace with :

$categories_obj = get_categories(array('taxonomy' => 'custom-taxonomy-for-your-custom-post-type'))

hope this help :_0


GDC-Linux comments:

Still nothing =/

The theme allows me to choose a "category" for each page so I can have a page with certain posts to show...

For example: I can create a page called "Supplements" and then it allows me to choose a categorie of posts i want that page to show, but if i choose a category that contains custom post types the theme wont show it.. it doesnt find any.

When i use the code above, it shows all posts on that page even when i choose on one category.


GDC-Linux comments:

When i place the code above at post-options.php i cant load my page says" It may be down for maintenance or configured incorrectly."

It shows the error is on $categories = array();


Daniel Yoen comments:

missing ";" at the end

sould be like this :

$categories_obj = get_categories(array('taxonomy' => 'custom-taxonomy-for-your-custom-post-type'));


try this :

<?php

/*

Template Name: Blog List

*/

?>

<?php get_header(); ?>

<div class="content-wrap">

<div class="content">

<?php tie_breadcrumbs() ?>



<?php if ( ! have_posts() ) : ?>

<div id="post-0" class="post not-found post-listing">

<h1 class="post-title"><?php _e( 'Not Found', 'tie' ); ?></h1>

<div class="entry">

<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'tie' ); ?></p>

<?php get_search_form(); ?>

</div>

</div>

<?php endif; ?>



<div class="page-head">

<h1 class="page-title">

<?php the_title(); ?>

</h1>

</div>



<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>

<?php $get_meta = get_post_custom($post->ID); ?>

<?php tie_include( 'post-head' ); // Get Post Head template ?>

<div class="entry"><?php the_content(); ?></div>

<?php endwhile; ?>



<?php //Above Post Banner

if( empty( $get_meta["tie_hide_above"][0] ) ){

if( !empty( $get_meta["tie_banner_above"][0] ) ) echo '<div class="ads-post">' .htmlspecialchars_decode($get_meta["tie_banner_above"][0]) .'</div>';

else tie_banner('banner_above' , '<div class="ads-post">' , '</div>' );

}

?>



<?php $cat_query = '';

if ( !empty( $get_meta["tie_blog_cats"][0] ) )
{
query_posts(array('post_type' => 'your-post-type-here', 'paged' => $paged, 'posts_per_page' => -1, 'your-taxonomy-name-here' => $get_meta["tie_blog_cats"][0])); //ajust this
}
else
{
query_posts(array('post_type' => 'your-post-type-here', 'paged' => $paged, 'posts_per_page' => -1)); //ajust this
}

?>

<?php get_template_part( 'loop', 'category' ); ?>

<?php if ($wp_query->max_num_pages > 1) tie_pagenavi(); ?>



<?php //Below Post Banner

if( empty( $get_meta["tie_hide_below"][0] ) ){

if( !empty( $get_meta["tie_banner_below"][0] ) ) echo '<div class="ads-post">' .htmlspecialchars_decode($get_meta["tie_banner_below"][0]) .'</div>';

else tie_banner('banner_below' , '<div class="ads-post">' , '</div>' );

}

?>



<?php comments_template( '', true ); ?>

</div><!-- .content -->



<?php get_sidebar(); ?>

<?php get_footer(); ?> get_footer(); ?>



try this :ry this :


GDC-Linux comments:

@Daniel Yoen - it didn't work it messed up the whole layout for some reason.

When I create a "page" i choose a template "Template-Blog.php" so it shows Posts depending on the category i choose. It allows me on "Page" edit to choose a categorie of posts to show but when i choose a categorie that contains custom post type it act's as if it cannot find any.

I don't want to be editing the files everytime i create a new custom post type or taxonomie because there will be alot of them and just cant be editing files everytime i add a new one.

I want to make the theme be able to show custom post type on the blog page when i choose the categorie from the page. Check picture attached