• ronniebrown

    (@ronniebrown)


    Hi

    I have a new site under development where the front page currently shows a Page with a list of child Sub-Pages. I am attempting to have this page show the content of the most recently created Sub Page, instead of what it’s currently showing.

    I’ve tried the following:

    <?php
    
      $how_many=1; //How many posts do you want to show
      require_once('wp-config.php'); // Change this for your path to wp-config.php file ?>
    
      <?
    
        $news=$wpdb->get_results("SELECT * FROM $wpdb->posts WHERE <code>post_parent</code>=\"3\" ORDER BY id DESC LIMIT $how_many");
    
        foreach($news as $np){
    
          printf ("<h1>%s</h1>%s", $np->post_title, $np->post_content);
    
        }
    
    ?>

    This gives me what I want but what is returned is just plain text (with no formatting) unlike what I see if I visit the page in question (<p> tags etc).

    I don’t really want to be creating my own query strings so could someone point me in the direction of an already created function that may solve my problem?

    Thanks in advance

    Ronnie

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter ronniebrown

    (@ronniebrown)

    Hi

    Is anyone able to help with this problem?

    It’d be much appreciated.

    Thanks

    Ronnie

    Thread Starter ronniebrown

    (@ronniebrown)

    Hey

    Anyone think of a solution to this problem? It’s driving me nuts?

    ??

    Ronnie

    Thread Starter ronniebrown

    (@ronniebrown)

    Hi

    Anyone WordPress gurus had a chance to look into this one?

    I will not let it die! ??

    Ronnie

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show latest sub-page under page’ is closed to new replies.