Number of Custom Post Types published are not being shown in the custom page
-
So this is the first time in which something like this happens to me. I’ve used the same method in some of my last projects and it works well but in the current template in which I’m working it is not.
Here is the custom page that displays the custom post type(snippets):
<?php /* Template Name: Snippets Template Post Type: page */ ?> <?php get_header(); ?> <?php include("includes/page-header.php"); ?> <div class="container"> <!-- Page Heading --> <div class="row"> <div class="col-md-12"> <div class="pull-left"> <button class="btn btn-sm btn-default" data-toggle="portfilter" data-target="all">All</button> <?php $terms = get_terms("snippets_categories"); // Consigue todas las categorias del custom taxonomy. $termsString .= $term->slug; $count = count($terms); //Cuantos categorias son? if ( $count > 0 ){ //Si es que hay mas de uno foreach ( $terms as $term ) { //Para cada termino: echo "<button class='btn btn-sm btn-primary' data-toggle='portfilter' data-target='".$term->slug."'>".$term->name."</button>\n"; } } ?> </div> <div class="clearfix"></div> <?php $snippets_query = new WP_Query(array( 'post_type' => 'snippets', 'order' => 'DESC', )); ?> <?php if($snippets_query->have_posts()) : while($snippets_query->have_posts()) : $snippets_query->the_post();?> <?php $terms_snippets = get_the_terms( get_the_ID(' '), 'snippets_categories'); ?> <?php $terms_snippet_slugs = array(); foreach ($terms_snippets as $tp) { $terms_snippet_slugs[] = $tp->slug; } $terms_snippet_csv = implode (' ',$terms_snippet_slugs); ?> <a class="snippet" href="<?php the_permalink(); ?>" data-tag="<?php echo $terms_snippet_csv; ?>"><?php the_title(); ?></a> <?php endwhile; ?> <?php else : ?> <div class="alert alert-danger text-center"><p>Ningun snippet encontrado</p></div> <?php endif; ?> </div> </div> </div><!-- /Container ---> <!-- /.row --> <?php get_footer(); ?>
This is my problem, I currently have 12 published posts. 2 with the category of Javascript, 2 others with the category of CodeIgniter, and 8 posts with the category of WordPress. I don’t know what the problem is but all the posts with the category of WordPress are not displayed in the custom page.
Any idea on how to fix this? Thanks is advance.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Number of Custom Post Types published are not being shown in the custom page’ is closed to new replies.