WordPress.org

Ready to get started?Download WordPress

Forums

Automatically create links of new pages on a page (5 posts)

  1. venc
    Member
    Posted 5 years ago #

    Hello, I'm quite a nob when it comes to this service, but can read some coding.

    I just want to ask if anyone knows how can a link be created on a specific page when new pages of a group is created. I have searched around and have not found anything, maybe bad wording on my part.

    Let say, for example, every time I create a page related to Group X, the Group X's page would show the new link to the 'new page' automatically.

    Thanks,
    J

  2. MichaelH
    Member
    Posted 5 years ago #

    Try this, at least to get acquainted with the possibilities:

    1. Change to the WordPress Default theme
    2. Copy wp-content/themes/default/links.php to wp-content/themes/default/pageofpages.php
    3. Edit pageofpages.php and change it to look like this:

    <?php
    /**
     * @package WordPress
     * @subpackage Default_Theme
     */
    
    /*
    Template Name: PageofPages
    */
    ?>
    
    <?php get_header(); ?>
    
    <div id="content" class="widecolumn">
    
    <h2>Pages:</h2>
    <ul>
    <?php wp_list_pages(); ?>
    </ul>
    
    </div>
    
    <?php get_footer(); ?>

    4. Vist Pages->Add new and create a Page call it "My Page listing of Pages" and in the Template pulldown, select "PageofPages"
    5. Then see how you like that by visting your blog.
    6. If necessary read wp_list_pages() to decide how you might want to limit what that list of pages displays (e.g. you might decide to use custom fields to assign some value to what you call Group X pages so you would use the meta_key and meta_value parameters).

  3. venc
    Member
    Posted 5 years ago #

    Thank you so much for the quick reply. I'll be trying that tonight!

  4. venc
    Member
    Posted 5 years ago #

    Hey, I have to use the default Theme only or can I use a different theme?

    Thanks

  5. MichaelH
    Member
    Posted 5 years ago #

    Oh you can use a different theme, but might need to adjust your div to your theme. The concept of
    Template Hierarchy applies, regardless of themes.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags