title: How To make pagination work correctly in WordPress?
body: <p>I am new to wordpress. I have a problem with pagination when I click to the next post it shows "not found". I installed the plugin wp pagenavi, and I put code in my blog post <code>&lt;?php wp_pagenavi(); ?&gt;</code>. It shows the pagination, but I have a problem with the link to the next post. Example when I click to the next post — <a href="http://westecmedia.com/events/page/2/" rel="nofollow">http://westecmedia.com/events/page/2/</a> — it shows:</p>
  
  <blockquote>
    <p>Something went Wrong! <br>
    404 <br>
    --></p>
  </blockquote>
  
  <p>You can see at: <a href="http://westecmedia.com/events/" rel="nofollow">http://westecmedia.com/events/</a></p>
  
  <p>And this is my code in event-page.php:</p>
  
  <pre><code>&lt;?php
  /*
   *  Template Name: Page - Events Page
   */
  ?&gt;
  
  &lt;?php get_header(); ?&gt;
  
  &lt;div id="content-events"&gt;
      &lt;div id="head-event"&gt;&lt;h3&gt;EVENTS&lt;/h3&gt;&lt;/div&gt;
      &lt;div id="main-event"&gt;
      &lt;?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?&gt;
  
          &lt;?php the_content(); ?&gt;
  
      &lt;?php endwhile; else: endif; ?&gt;
  
      &lt;?php query_posts('category_name='.get_the_title().'&amp;post_status=publish,future');?&gt;
  
      &lt;?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?&gt;
      &lt;div id="part-event"&gt;
      &lt;div id="entry-thumbnail"&gt;
              &lt;?php the_post_thumbnail(); ?&gt;
  
      &lt;/div&gt;
      &lt;div id="event-dess"&gt;
      &lt;h2&gt;&lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt;
          &lt;p&gt;
              &lt;?php 
              $content = get_the_content();
              $content = strip_tags($content);
              echo substr($content, 0, 300);
              ?&gt;
          &lt;/p&gt;
          &lt;div id="read-more"&gt;&lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;Read More&lt;/a&gt;&lt;/div&gt;
      &lt;/div&gt;
  
  &lt;/div&gt;
          &lt;div id="line-bottom"&gt;&lt;/div&gt;
      &lt;?php endwhile; else: endif; ?&gt;
          &lt;?php wp_pagenavi(); ?&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;?php get_footer(); ?&gt;
  </code></pre>
  
  <p>Who can help me please?</p>