WordPress.org

Ready to get started?Download WordPress

Forums

Recent Posts Links not working? (6 posts)

  1. heartofwisdom
    Member
    Posted 6 years ago #

    My Recent Posts Links are not working correctly. Sometimes they work sometimes I get Sorry, no posts matched your criteria.

    See http://Heartofwisdom.com/blog

    Permalinks are set to /%scategory%/%postname%/

    My Popular links work but Recent not usually.

    Any help appreciated.

  2. cryonics
    Member
    Posted 6 years ago #

    Permalinks are set to /%scategory%/%postname%/

    Is there really a trailing slash?

  3. heartofwisdom
    Member
    Posted 6 years ago #

    Yes I just checked. ANY help appreciated!

  4. heartofwisdom
    Member
    Posted 6 years ago #

    When I click on the recent post "Should Homeschoolers Teach Logic" the link should be
    http://heartofwisdom.com/blog/homeschool/should-homeschoolers-teach-logic

    but in recent post its
    http://heartofwisdom.com/blog/spiritual-growth/object-lessons/be-the-branch/?p=304

    Here is the code<h2 class="coltitle">Recent posts</h2>
    <?php
    $today = current_time('mysql', 1);

    if ( $recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'publish' AND post_date_gmt < '$today' ORDER BY post_date DESC LIMIT 15")):
    ?>

      <li id="recents">

      <?php
      foreach ($recentposts as $post) {
      if ($post->post_title == '')
      $post->post_title = sprintf(__('Post #%s'), $post->ID);
      echo "
    • ID'>";
      the_title();
      echo '
    • ';
      }
      ?>

    <?php endif; ?>

  5. heartofwisdom
    Member
    Posted 6 years ago #

    I went back to my original files and replaced the code. The home page links are workig but if I am on another page the links don't work.

    Any ideas?

  6. cryonics
    Member
    Posted 6 years ago #

    Try

    /%category%/%postname%

Topic Closed

This topic has been closed to new replies.

About this Topic