WordPress.org

Ready to get started?Download WordPress

Forums

how can I prevent some page links from showing in the sidebar/header? (7 posts)

  1. drb05
    Member
    Posted 8 years ago #

    Hi all,
    I have created several pages in WP 201 and using modern theme from (http://ulfpettersson.se/). In this particular theme, it adds the newly created page links in header.php (i think it goes in header.php instead of sidebar.php).

    My wish is not to show some pages hyperlinks in the navigation. How can I do that?

    Any help please?

    drb

  2. Samuel B
    moderator
    Posted 8 years ago #

    In header.php look for this line or similar"

    <?php wp_list_pages('sort_column=menu_order&depth=1&title_li='); ?>

    All themes aren't the same, but adjusting this should work.

    You could probably get a more specific resolution at your author's theme site if you're not comfortable working with php.

  3. Kahil
    Member
    Posted 8 years ago #

    wp_list_pages('sort_column=menu_order&depth=1&title_li=&exclude=X,X');

    It'll look like that if you want to exclude some pages... just replace the X's with the page numbers, you can find those on your manage > pages section.

  4. drb05
    Member
    Posted 8 years ago #

    Awesome the later code 'exclude' worked. Made my day!.

    Thanks a bunch.

    I got two more questions, though.

    1. how can I safely remove 'posts' and 'comments' sections (or atleast disable so as not to see in the site) and also 'categories' link in the sidebar.php?

    I tried taking some codes out with my limited knowledge. but it messed up some of my layout.

    The index.php has the follwoing lines:

    <?php get_header(); ?>

    <div id="content">
    <p align="justify">some stuff that i have here....

    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>

    <p class="postmetadata"><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> -->
    <div class="post" id="post-<?php the_ID(); ?>">
    <h2>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></h2>

    <div class="entry">
    <?php the_content('Read the rest of this entry »'); ?>
    </div>

    <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit','','|'); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
    </div>

    <?php endwhile; ?>

    <div class="navigation">
    <div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div>
    <div class="alignright"><?php previous_posts_link('Next Entries »') ?></div>
    </div>

    <?php else : ?>

    <h2>Not Found</h2>
    Sorry, but you are looking for something that isn't here.
    <?php include (TEMPLATEPATH . "/searchform.php"); ?>

    <?php endif; ?>

    </div>

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

    2. How can i add an external link (pointing to some other html page) in sidebar?

    Sorry to continue in the same thread.

    Please help.

    Thanks,

    drb

  5. Kahil
    Member
    Posted 8 years ago #

    the first question, i'm not sure exactly what you are asking. What are you trying to do with the page?

    the second question, all you have to do is go into your theme editor and edit the sidebar by adding the link wherever you would like if you don't want to use the built in link section for your side bar. the code will look exactly the same as when you put a link in a post/page.

  6. drb05
    Member
    Posted 8 years ago #

    Sorry, even I got confused after reading my post.

    I'll try to be clear.
    what I am trying to is not to show the posts, comments on index page when somebody visits the blog. It should just have the
    <div id="content">
    <p align="justify">some stuff that i have here....

    under
    <?php get_header(); ?>

    Then when somebody clicks on categories, or archives, they should be able to see the posts.

    So on the whole, no posts, comments, etc on index.page.

    Is that possible?

    (probably I will look for some 'top 5 recent posts' plugin elsewhere to display the list in sidebar.

    thanks,

    drb

    But the posts, comments section should be functional.

  7. Kahil
    Member
    Posted 8 years ago #

    i think your best bet is to not do all that and just use one of the plugins that lets you use a static page as your home page...

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.