Forums › Forums › Search & Filter Pro › Custom Post Type only displaying 1 result
Tagged: cpt, custom taxonomy, results
- This topic has 17 replies, 2 voices, and was last updated 8 years, 6 months ago by Trevor.
-
Anonymous(Private) June 3, 2016 at 6:22 pm #47439
Sorry again, I’ve told you wrong. I’ve been messing with this for hours and I’ve lost all sense of reality. You are right, Im not sure how the results are being shown like this. I originally had it set up with the search.php like this:
<?php /** * Template Name: Blog List Template */ get_header(); ?> <div id="primary" class="content-area"> <center> <?php echo do_shortcode('[searchandfilter id="423" fields="ecmo, lhr_ratio, side, liver" all_items_labels=",ECMO Required, All LHR, CDH side, Liver Orientation"]'); ?> </center> <main id="main" class="site-main list" role="main" <?php hybrid_attr( 'content' ); ?>> <?php $paged = ( get_query_var( 'page' ) ) ? get_query_var( 'page' ) : 1; $args = apply_filters( 'bulan_blog_list_query', array( 'post_type' => 'graduates', 'paged' => $paged ) ); ?> <?php $wp_query = new WP_Query( $args ); ?> <?php if ( $wp_query->have_posts() ) : ?> <?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?> <?php if ( is_sticky() ) : ?> <?php get_template_part( 'content', 'home' ); ?> <?php else : ?> <?php get_template_part( 'content', 'blog-list' ); ?> <?php endif; ?> <?php endwhile; ?> <?php get_template_part( 'loop', 'nav' ); // Loads the loop-nav.php template ?> <?php else : ?> <?php get_template_part( 'content', 'none' ); ?> <?php endif; wp_reset_postdata(); ?> </main><!-- #main --> </div><!-- #primary --> <?php get_footer(); ?>
Which was giving the results that we are seeing now…
Maybe I should scrap the whole thing and start fresh.
Trevor(Private) June 3, 2016 at 7:37 pm #47447Ah. Accordions. It probably would work.
Anyway, the weekend is here.
Over the weekend, can you try to return it back to ‘normal and try to get the shortcode method working with as little coding (or none) and ignore how bad the results look, as long as they are the right results.
I will drop in from time to time and check progress if you post here.
Anonymous(Private) June 6, 2016 at 11:59 pm #47647Ok problem solved. Since the wp_queries do not work in the custom template, all that is needed is the
<?php while (have_posts()) : the_post(); ?>
Don’t know why I didnt realize that sooner. Thank you for your support during this time of great personal distress. You are the man!For anyone following this, here is my custom post template.
<!DOCTYPE html> <html <?php language_attributes(); ?>> <head> <meta charset="<?php bloginfo( 'charset' ); ?>"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="profile" href="http://gmpg.org/xfn/11"> <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>"> <?php wp_head(); ?> </head> <body <?php body_class(); ?> <?php hybrid_attr( 'body' ); ?>> <div id="page" class="site"> <div class="headbar"> <div class="logo-image"><img src="http://realhopeforcdh.com/cms/wp-content/uploads/2016/05/real-hope-logo.jpg"></div> </div> <div class="search-area"> <div class="wide-container"> <?php get_search_form(); // Loads the searchform.php template. ?> </div> </div> <?php get_template_part( 'menu', 'primary' ); // Loads the menu-primary.php template. ?> <div id="content" class="site-content"> <div class="wide-container"> <?php echo do_shortcode('[searchandfilter id="423"]'); ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <!---TITLE What shows before click --> <div class="collapseomatic noarrow" id="<?php the_ID(); ?>" title="Trigger 1"> <div class="mid-line"> <h2><?php the_title(); ?></h2></div> <div class="post-image"> <?php the_post_thumbnail( 'large', array( 'class' => 'entry-thumbnail', 'alt' => esc_attr( get_the_title() ) ) ); ?> </div> </div> <!---END What shows before click --> <!---TITLE What shows AFTER click --> <div id='swap-<?php the_ID(); ?>' style='display:none;'> <div class="mid-line"> <h2><?php the_title(); ?></h2></div> <div class="post-image"> <?php the_post_thumbnail( 'large', array( 'class' => 'entry-thumbnail', 'alt' => esc_attr( get_the_title() ) ) ); ?> </div> </div> <!---END What shows after click --> <!---BEGIN EXCERPT What shows before click --> <div id="excerpt-<?php the_ID(); ?>" class="collapseomatic_excerpt "><?php the_excerpt(); ?> <div class="collapseomatic noarrow" id="<?php the_ID(); ?>" title="Trigger 1"><div class="toggle-read-more">Read More</div></div> <hr> </div> <!---END What shows before click --> <!---BEGIN CONTENT What shows before click --> <div id="swapexcerpt-<?php the_ID(); ?>" style="display:none;"> <?php the_content(); ?> <div class="collapseomatic noarrow" id="<?php the_ID(); ?>" title="Trigger 1"><div class="toggle-read-less"> Read Less</div></div> <?php echo do_shortcode('[ssba]'); ?> <div class="grad-info"> <h2 class="alignleft">CDH diagnosis</h2> <table> <tr> <td><span>ECMO Required: </span></td> <td><span><?php the_field('ecmo_required'); ?></span></td> </tr> <tr> <td><span>CDH Side: </span> </td> <td><span><?php the_field('left_or_right_side'); ?></span></td> </tr> <tr> <td><span>Liver Orientation: </span></td> <td><span><?php the_field('liver_up_or_liver_down'); ?></span></td> </tr> <tr> <td><span>LHR: </span></td> <td><span><?php the_field('lung_to_head_ratio'); ?></span></td> </tr> </table> </div> </div> <!---END What shows after click --> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div> <div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div> </div> <?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php get_search_form(); ?> <?php endif; ?> <hr /> </center> <div class="pagination"> <div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div> <div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div> </div> <?php get_footer(); ?>
-
AuthorPosts