Forums

Autogenerate sub-index pages with excerpts (8 posts)

  1. Josh Fialkoff
    Member
    Posted 3 years ago #

    Hi,

    I am trying to create level 2 (i.e., pages one level below the home page) pages which automatically list all of the pages within the directory, with excerpts.

    So, for instance the "Clients" index page would look something like this (assuming that Company A and Company B are pages within the Clients directory):

    • Company A
      We helped this company double in size.
    • Company B
      We made this company look awesome.

    Thanks!
    -Josh

  2. moshu
    Member
    Posted 3 years ago #

    It would be good to use the adopted WP terminology to avoid misunderstandings...

    index = you main template file in the theme, nothing else. It has nothing to do with Pages which are special "animals" in WP.

    After reading the Docs at the link above you will know that Pages can be in parent/child relationship, usually we call them "subpages".
    Oh, and there are NO directories when it comes about posts or Pages, because everything is stored in the database.

  3. Josh Fialkoff
    Member
    Posted 3 years ago #

    Thank you for the clarification. ;-)
    -Josh

  4. Josh Fialkoff
    Member
    Posted 3 years ago #

    I re-read the Pages docs and altered the parent page.

    It is correctly listing the child pages.

    I would now like to display the excerpt in the same

  5. as the page title.

    Here is the code:


    <?php the_content('<p class="serif">More »</p>'); ?>

      <?php
      wp_list_pages('title_li=&child_of='.$post->ID.'&date_format=$date_format'); ?>

    Can you please point me in the right direction for using the excerpt tag with wp_list_pages?

    Thanks again for your help!
    -Josh

  • moshu
    Member
    Posted 3 years ago #

    Can you please point me in the right direction for using the excerpt tag with wp_list_pages?

    No, you can't use them together. They have nothing to do with each other.
    And no, the wp_list_pages will never display anything else than the list (titles) of Pages.

    And out of the box (meaning without forcing WP to do unnatural things...) there is no "multi-Page view". You can see only one Page at a time, as opposed to posts which do have multipost view - in index, in archives, in category listing, in search results...

  • mores
    Member
    Posted 3 years ago #

    Well then ...what's the unnatural way to do it?
    I just set up a site to use Pages only to find out, there is no easy way to get a Page excerpt like I could get a post excerpt?

    hmmmmm ...

  • mores
    Member
    Posted 3 years ago #

    Please forive me for bumping this thread up ... it's sort of an emergency.
    I can't solve my problem with posts and categories, and with pages it's apparently not possinble :(

    I want to have a "sidebar" with the other posts of that category.
    So if I click on a category in the navigation (using wp_list_categories), I want to show the first post of this category, with the other posts in the sidebar along with an excerpt of those.
    Then when I click on one of these other posts, I want to see this post as well as the other posts within this category in the sidebar. Ideally excluding the post we're currently looking at.

  • patricia1706
    Member
    Posted 3 years ago #

    I think a lot of people are looking for this function as they use WP more and more like a CMS and not a blog site. I found this looking for the same thing
    http://wpguru.co.za/page/display-title-excerpt-of-child-pages/
    They posted this code (to be pasted BELOW the main loop on say page.php)

    <? $pageChildren = $wpdb->get_results("SELECT *	FROM $wpdb->posts WHERE post_parent = ".$post->ID."	AND post_type = 'page' ORDER BY menu_order", 'OBJECT');	?>
    <? if ( $pageChildren ) : foreach ( $pageChildren as $pageChild ) : setup_postdata( $pageChild ); ?>
    <!-- loop stuff here -->
    <? endforeach; endif; ?>

    It's not displaying child page titles with excerpts (for me), perhaps if a PHP guru would have a look they would have a thought about how to correct this.

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags