WordPress.org

Support

Support » Plugins and Hacks » Display Page AND Post List

Display Page AND Post List

  • Hello! I currently use the Filosofo Home-Page Control to make one of my pages display as the default home page, instead of showing a list of the most recent posts. I was wondering if there was a way to somehow do both by creating a new index.php template.

    Basically hard-code a page to display and then display the last few posts. I’ve tried doing it although end up having a problem because certain variables have already been set…

    Any thoughts?

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • I use this function:

    <?php function include_page ($post_id, $filter=TRUE) {
    global $wpdb;
    $pages = $wpdb->get_results ("SELECT " .
    "post_content " .
    "FROM $wpdb->posts " .
    "WHERE ID = " . $post_id);
    if ($pages):
    foreach ($pages as $page):
    if ($filter):
    $page->post_content = apply_filters('the_content',stripslashes($page->post_content));
    else:
    $page->post_content = stripslashes($page->post_content);
    endif;
    echo $page->post_content;
    endforeach;
    endif;
    } ?>

    Then call it (<?php include_page('2'); ?>) above the loop in the home.php file in your template.

    This is excellent and just what I was looking for!

    THANK YOU!!!

    I know I’m probably asking for a lot, but would you know how to change this so the page information didn’t display on any of the ‘previous’ pages?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Display Page AND Post List’ is closed to new replies.
Skip to toolbar