• idlan

    (@idlan)


    The setup is as follows:

    I have a static intro page, where I would like to show the latest entries from two WP powered blogs currently on my server. I have used the code from https://codex.www.ads-software.com/Creating_a_Static_Front_Page. Because I need to call from two different wp-config.php files, I modified the require_once() command to include(path/to/wp-config.php). This is shown in the code below. However what has happened is that I get the latest entry from only one blog – you can see this here: https://www.idlanzakaria.com/home.php

    I am very sure the correction is very minor, but I am a total PHP novice, and am totally stuck. I’d be grateful for any and all pointers.

    Here is the code I used:

    <?php
    $how_many=5; //How many posts do you want to show
    include(“/home/idlanzak/public_html/conversed/wp-config.php”); // Change this for your path to wp-config.php file ?>
    <ol id=”whats-new”>

    <?
    $news=$wpdb->get_results(“SELECT ID,post_title FROM $wpdb->posts
    WHERE post_status= \”publish\” ORDER BY ‘ID’ DESC LIMIT “.$how_many);
    foreach($news as $np){
    printf (”

    • %s
    • “, $np->ID,$np->post_title);
      }?>

      <?php
      $how_many=5; //How many posts do you want to show
      include(“/home/idlanzak/public_html/wordpress/wp-config.php”); // Change this for your path to wp-config.php file ?>
      <ol id=”whats-new”>
      <?
      $news=$wpdb->get_results(“SELECT ID,post_title FROM $wpdb->posts
      WHERE post_status= \”publish\” ORDER BY ‘ID’ DESC LIMIT “.$how_many);
      foreach($news as $np){
      print (”

    • <a href=\””);
      echo get_permalink($np->ID);
      print (“\”>$np->post_title
    • “);
      } ?>

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Static Splash Page: Loop Coding Problems’ is closed to new replies.