I’ve been troubleshooting for days now and I can’t seem find the problem on getting the WP PageNavi work on my search.php results page.
Here’s the code for my search.php
<?php if ( have_posts() ) : ?>
<?php $page = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
query_posts(“showposts=1&paged=$page”);?><?php while ( have_posts() ) : the_post() ?>
<div class=”post”>
<div class=”image-container”>“> <img src=”<?php the_field(‘thumbnail_image’); ?>” alt=””> </div>
<!–image container–>
<div class=”article”>
<h2>“>
<?php the_title(); ?>
</h2>
<p>
<?php the_field(‘excerpt’); ?>
</p>
” class=”readmore”>Read More > </div>
<!–article–>
<div class=”article-2″> <span class=”price”>
<?php the_field(‘price’); ?>
</span>
<div class=”stars”> <img src=”<?php the_field(‘rating_image’); ?>” alt=””> </div>
<!–stars–>
<div class=”company”> “><img src=”<?php the_field(‘company_icon’); ?>” alt=””> </div>
<!–company–></div>
<!–article 2–>
<div class=”clear”></div>
</div>
<!–post–><?php endwhile; ?>
<?php wp_pagenavi(); ?>
[please remember to mark any posted code properly – https://codex.www.ads-software.com/Forum_Welcome#Posting_Code ]
I tried every solution but I really can’t the page 2,page 3 and so on, to show up.
It keeps showing 404 error page.
Thanks!
]]>the website is: https://www.atlaserlights.com/blog
the code on the index.php file reads:
https://pastebin.com/mgfaxFhb
<?php get_header(); ?>
<div id="primary">
<div id="content" role="main">
<?php query_posts($post_string . '&cat=-5'); ?>
<?php if ( have_posts() ) : ?>
<?php twentyeleven_content_nav( 'nav-above' ); ?>
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
<?php twentyeleven_content_nav( 'nav-below' ); ?>
<?php else : ?>
<article id="post-0" class="post no-results not-found">
<header class="entry-header">
<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1>
</header><!-- .entry-header -->
<div class="entry-content">
<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?></p>
<?php get_search_form(); ?>
</div><!-- .entry-content -->
</article><!-- #post-0 -->
<?php endif; ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
]]>. This is the site so please check and help me.
index.php
https://pastebin.com/PQhf3cXB
I’m working on a site where I load multiple custom templates in 1 page. In 2 of the templates I load in posts of 2 different categories.
With some help of you guys I figured out how I got the navigation (via wp-pagenavi) work, with 1 categorie on the site. But now I have 2 and things are going wrong.
For example: I’ve got 2 posts for categorie A and 2 for categorie B. The navigation should show 2 pages per categorie, but instead It shows 4. Yet categorie A filters the posts for A and vice versa. So if I’m on page 1 or 2 I see a post at categorie A, but none at B. And when I’m on page 3 or 4 I see a post at categorie B, but none at A.
It seems to act like 1 navigation for both.
This is the code in the 2 templates I use to load the categories:
<?php global $wp_query, $meta ,$paged;
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query('cat=3');
$wp_query->query("paged=$page&cat=3&showposts=2&order=ASC");?>
<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>
Can you help me please? Thanks in advance!
[ Please don’t bump, that’s not permitted here. ]
]]>I’m trying to find an approach to create a hierarchy menu for pages. Imagen we have hierarchy of pages:
Page 1
— Page 1.1
— Page 1.2
—- Page 1.2.1
—- Page 1.2.2
and so on.
Is there some way to build menu according to displayed page:
– for Page 1.2: Page 1 > Page 1.2
– for Page 1.2.2: Page 1 > Page 1.2 > Page 1.2.2
etc.
]]>