Zdravím, mám níže uvedený kod, pomocí, kterého na stránce vytvářím seznam produktů. Pod produkty se však se však vypisuje i původní příspěvky, z kterých se čerpají produkty. Je možné příspěvky nějak skrýt? Děkuji
add_action('init', 'products_register');
function products_register() {
$labels = array(
'name' => _x('Produkty', 'post type general name'),
'singular_name' => _x('Produkt', 'post type singular name'),
'add_new' => _x('Přidat nový', 'portfolio item'),
'add_new_item' => __('Přidat nový produkt'),
'edit_item' => __('Upravit produkt'),
'new_item' => __('Nový produkt'),
'view_item' => __('Zobrazit produkt'),
'search_items' => __('Vyhledat produkt'),
'not_found' => __('Nic nebylo nalezeno'),
'not_found_in_trash' => __('Nic nebylo nalezno v koši'),
'parent_item_colon' => ''
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => array('slug' => '/', 'with_front' => false,),
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => null,
'supports' => array('title','editor','thumbnail', 'excerpt')
);
register_post_type( 'products' , $args );
}
function get_products($atts = array(), $content = null){
query_posts( $args );
extract(shortcode_atts(array(
'ids' => '',
), $atts));
?>
<?php ob_start(); ?>
<?php $args = array('post_type' => 'products', 'order' => 'asc', 'post__in' => explode(",",$ids)); ?>
<?php query_posts( $args ); ?>
<div class="firm">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<a class="way" href="<?php the_permalink(); ?>">
<?php the_post_thumbnail(); ?><?php the_title(); ?>
</a>
<?php endwhile; ?>
<?php endif; ?>
</div>
<?php
$html = ob_get_contents();
ob_end_clean();
return $html;
}
add_shortcode('produkty','get_products');