Forum Replies Created

Viewing 15 replies - 16 through 30 (of 226 total)
  • If you want different links in the two menus, then I don’t think either Exclude Pages or Page Lists Plus will get you there.

    To specify which pages appear in your top menu without losing the button states, try replacing the <?php art_menu_items(); ?> function call in your header.php theme file with this:

    <?php
    $page_list = wp_list_pages('title_li=&sort_column=menu_order&echo=0&include=1,2,3');
    $page_list = preg_replace('<code><a(.+)</a></code>', '<a$1</span></span></a>', $page_list);
    $page_list = preg_replace('<code><a(.+)&quot;></code>', '<a$1"><span><span>', $page_list);
    echo $page_list;
    ?>

    Replace “1,2,3” with a comma-separated list of the IDs of the pages that you’d like to include there.

    For your sidebar, this should do if you want to specify which pages do appear there:

    <?php wp_list_pages(title_li=&sort_column=menu_order&include=1,2,3); ?>

    Alternatively, use this to specify which pages don’t appear there:

    <?php wp_list_pages(title_li=&sort_column=menu_order&exclude=1,2,3); ?>

    Hope that works. Let us know how you get on.

    – Tim

    Instead of hard-coding the footer links, include them in the footer:

    <ul>
    <?php wp_list_pages('sort_column=menu_order&title_li=&include=17,38'); ?>
    </ul>

    – Tim

    Hi,

    As of more recent versions of WP, you can use wp_page_menu() to create a Page list with a “Home” link.

    – Tim

    Hi Tom,

    Does the link to your third-level page appear in your HTML?

    If it does, then this is a styling issue; what theme are you using?

    If it doesn’t, then check the depth parameter in the wp_list_pages() function call in your header.php theme file. If you see “depth=2”, then change it to “depth=3”.

    – Tim

    Assured by who? On these forums, support is provided by volunteers who have no obligation whatsoever to help you, but may (or may not) choose to give up their free time to do so.

    One option to make your site private is the Registered Users Only plugin (something else provided by a volunteer).

    For paid support, try the WP Pro mailing list.

    – Tim

    Now fixed. The code above is fine (with the closing double quote added), as long as the default “wp_” table prefix is used. In this case, the table prefix had been changed so it needed a global $wpdb; adding before the code, and the table name changing to $wpdb->prefix . "posts".

    – Tim

    The plugins modify WP’s native wp_list_pages() function, which in most cases should be used to generate Page lists. If a theme uses its own custom functions instead of native WP functions, then users shouldn’t expect plugins to work with it.

    Why do so many developers use custom functions when there are native functions that will do?

    – Tim

    Hi Daniello,

    A temporary admin account so that I can see what’s going would help.
    Email address is tim @ technokinetics.com.

    – Tim

    In what folder are your “nav_off_” images? The path to them seems to be broken.

    – Tim

    Hi Daniello,

    It looks to me like the code above does what I was aiming for, i.e. it limits your str_replace to just top-level Pages (although I see now that class="page_item page-item-'.$ID might be better as class="page_item page-item-'.$ID.'"').

    However, I see now that your menu isn’t just a Page list, and that the items that you want to modify aren’t page items, so what you’re asking for can’t be done by modifying your wp_list_pages output.

    If you post the code that generates your menu, perhaps I or someone else will take another shot at this.

    – Tim

    Hi,

    One option is to can use a plugin (e.g. Page Lists Plus, or Exclude Pages) that lets you choose which Pages appear in your Page menus.

    – Tim

    Another option for this is Page Lists Plus.

    (1) Install and activate.
    (2) On the Settings > Page Lists Plus page in the dashboard, check the “Unlink” checkbox in the “Page-Specific Options” section, and “Save Changes”.
    (3) On the edit screen of each Page that you want to unlink, scroll down to the “Page Lists Plus” box and uncheck the “Link” checkbox, then “Update Page”.

    Note that this will remove the link’s anchor tags, which can affect styling. If that’s a problem:

    (4) Fix your styling in your style.css theme file.
    or
    (5) On the Settings > Page Lists Plus page in the dashboard, check the “Unlink using javascript” checkbox in the “Global Options” section, and “Save changes”.

    – Tim

    I’m glad you got this working, but:

    (1) Your latest posts page, using your index.php theme file, should be your home page by default; you shouldn’t have to change anything under Settings > Reading to achieve this.

    (2) You should be able to add a “Home” link to your Page list without creating an extra Page or using a plugin, e.g. by using wp_page_menu().

    Not that there’s a problem with the solution that you’ve ended up with, but for others trying to do the same thing it won’t necessarily be the best solution.

    – Tim

    Hi Daniel,

    Not tested, but:

    (1) “SELECT ID FROM wp_posts WHERE post_parent = ‘0’ AND post_type = ‘page’ AND post_status = ‘publish'” should return an array containing the IDs of your top-level Pages.
    (2) In Page lists, every list item has a unique class “page-item-x”, where x is the Page ID. With a list of all your top-level Page IDs you should therefore be able to target your str_replace to just your top-level Pages.

    Using the code in the OP as a starting point, you’ll end up with something like this:

    $my_pages = wp_list_pages('title_li=&echo=0');
    $top_level_pages = mysql_query("SELECT ID FROM wp_posts WHERE post_parent = '0' AND post_type = 'page' AND post_status = 'publish'");
    while ($row = mysql_fetch_assoc($top_level_pages)) {
    	extract($row);
    	$my_pages = str_replace('<li class="page_item page-item-' . $ID, '
    <li><span class="qmdivider qmdividery"></span></li>
    <li class="page_item page-item-' . $ID, $my_pages);
    }
    $my_pages = str_replace('<ul', '<ul class="wordp_listsubs_sec"', $my_pages);
    echo $my_pages;

    – Tim

    No, IE6 doesn’t support li:hover. The best solution is to use javascript to emulate this for users of IE6. See https://www.alistapart.com/articles/horizdropdowns/ for one way of doing this.

    – Tim

Viewing 15 replies - 16 through 30 (of 226 total)