• Resolved klifix

    (@klifix)


    Hello,

    Can someone please help me with this?

    This is the problem:

    On my frontpage (www.klifix.nl) I have insert to my sidebar the last 5 posts on the frontpage.
    I also want the last 5 posts of movies.klifix.nl & radio.klifix.nl on my frontpage to appear.
    The question is: How do have to edit the following php-code to do this?

    The code:

    <?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 ”

    • <font color=#000099><b>* </b></font>ID’>”;
      the_title();
      echo ‘
    • ‘;

      }
      ?>

    <?php endif; ?>

Viewing 3 replies - 76 through 78 (of 78 total)
  • Kafkaesqui

    (@kafkaesqui)

    Okay, I think I got it.

    Yeah, it would be the value you’re passing for the truncate() $char argument. In the second code block it’s 60, which would only affect long titles.

    As for the black dots, if they’re doing this on your setup, I wouldn’t be able to tell from the…truncated code appearing above. So visit:

    https://wordpress.pastebin.ca

    Paste your code there, and reply back with the url you receive for it.

    philip3657

    (@philip3657)

    I’m guessing the problem is either in teh stylesheet or the sidebar, so I included both on here:

    https://wordpress.pastebin.ca/264127

    Thanks for your help by the way! I really appreciate it!

    Kafkaesqui

    (@kafkaesqui)

    You’re apparently just seeing standard list tag bullets. Try wrapping a <ul> element around it, which A. makes it valid XHTML, and B. should pick up the styling from your stylesheet the other unordered list tags in your sidebar already use:

    <h2>Recent Entries</h2>
    <ul>

    <?php endwhile; endif; ?>
    </ul>

Viewing 3 replies - 76 through 78 (of 78 total)
  • The topic ‘The PHP code for the last 5 posts’ is closed to new replies.