Forums › Forums › Search & Filter Pro › Can't make custom archive to work…
Tagged: andrey@accosites.co.il
- This topic has 12 replies, 2 voices, and was last updated 6 years, 10 months ago by Trevor.
-
Anonymous(Private) January 15, 2018 at 1:41 pm #152534
Hello,
so I use with custom template…
Here my configuration:
http://prntscr.com/i0ppzn
http://prntscr.com/i0pqochere the code inside search.php
<?php get_header(); ?> <h1>Search.php</h1> <?php echo do_shortcode('[searchandfilter id="1793"]'); ?> <pre style="direction: ltr;text-align: left;"> <?php print_r($_GET); ?> </pre> <div class="container" id="main"> <div class="row"> <div class="list"> <?php $count_news = 0; $query = new WP_Query(array( "post_type" => "news", "search_filter_id" => 1793 )); if ($query->have_posts()): while ($query->have_posts()): $query->the_post(); $count_news++; ?> <div class="col-xs-4"> <article <?php post_class(); ?>> <?php if(has_post_thumbnail()): ?> <img src="<?php the_post_thumbnail_url() ?>" class="img-responsive" /> <?php else: ?> <img src="/wp-content/uploads/2018/01/slider_placeholder.jpg" class="img-responsive" /> <?php endif; ?> <?php the_title("<h1 style='font-size:20px;font-weight:bold;'>", "</h1>"); ?> <?php echo mb_substr(get_the_content(), 0, 150) . "..." ?> </article> </div> <?php if($count_news % 3 == 0): ?> <div class="clearfix"></div> <?php endif; ?> <?php endwhile; endif; ?> <?php echo paginate_links() ?> </div> </div> </div> <?php get_footer(); ?>
can’t make it work…
what I’m doing wrong?
Thank you.Trevor(Private) January 15, 2018 at 2:42 pm #152563mmm.
One thing I can see in your template is this line:
<?php echo mb_substr(get_the_content(), 0, 150) . "..." ?>
Using get_the_content() will retrieve content with
<p>...</p>
around it, but applying the mb_substr will remove the end</p>
, which means the content will broken.You would be better to read this:
http://smallenvelop.com/limit-post-excerpt-length-in-wordpress/
But I am not sure why the Ajax does not work. If you switch off Ajax, does it then work (with a page re-load)?
Trevor(Private) January 15, 2018 at 7:33 pm #152645Whatever stops infinite scroll stops ajax (or vice versa). I would suspect a javascript file.
It will take me a while to do, so it will have to be tomorrow, but I will use Chrome and adblock in the inspector to stop the loading of each js file in turn to check them all.
-
AuthorPosts