WordPress.org

Ready to get started?Download WordPress

Forums

Excluding Pages on Blix Theme (14 posts)

  1. HomeOfficeVoicecom
    Member
    Posted 9 years ago #

    I want to add a handful of pages to my Blix theme that I don't want to appear in the navigation.

    Is there a way to exclude certain pages from appearing in the navigation?

  2. HomeOfficeVoicecom
    Member
    Posted 9 years ago #

    Don't worry about it, I've played under the hood a little and found a fix.

    I've simply removed all the navigation coding in the Header file and hardcoded in the pages links.

    Blix is the best theme I've come across but is needlessly complicated (IMHO) in this regard.

  3. masquerade
    Member
    Posted 9 years ago #

    There is an array called something like $BX_excluded_pages to which you can add your page.

  4. chriggi
    Member
    Posted 9 years ago #

    As I understand, this $BX_excluded_pages function is only for navigation in the sidebar. The top navigation does not use this function.

    I managed to exclude pages without hardcoding it by changing the BX_get_pages function in BX_functions.php. I inserted in the query a condition to exclude the specific page.

    So I changed:

    function BX_get_pages($with_content = '')<br />
    {<br />
    global $wpdb;<br />
    $query = "SELECT ID, post_title, post_name FROM " . $wpdb->posts . " WHERE post_status='static' ORDER BY menu_order ASC";<br />

    to:

    function BX_get_pages($with_content = '')<br />
    {<br />
    global $wpdb;<br />
    $query = "SELECT ID, post_title, post_name FROM " . $wpdb->posts . " WHERE post_status='static' &&amp; post_title!='fotoalben' ORDER BY menu_order ASC";

    by inserting the conditon post_title!=PAGETITLE with the specific page title I wanted to exclude. Hope that helps.

  5. NigelMellish
    Member
    Posted 8 years ago #

    Hi,

    I'm looking to do the same thing, but with something like 25 pages...

    would I just add:

    post_title!='firstpage'; post_title!='secondpage''; etc...

    All of the pages I want to exclude are children pages, do you think I could just make some flavor of declaration to exclude all pages with in an id range (i.e. all with an i.d. > 7)?

  6. Mazalien
    Member
    Posted 8 years ago #

    There is not much room in the Blix theme menu. In my case I made pages wich I wanted in the menu first, and while doing so they get a very low ID-number in the wordpress-database.
    Then I added the following selector into the function BX_get_pages : “AND ID<19 “
    So the number “19 “ depends on the ID’s of your own website.

    The altered code of the function BX_get_pages in the file BX_functions.php :

    'function BX_get_pages($with_content = '')
    {
    global $wpdb;
    $query = "SELECT ID, post_title, post_name FROM " . $wpdb->posts . " WHERE post_status='static' AND ID < 19 ORDER BY menu_order ASC ";
    if ($with_content == "with_content") {
    $query = "SELECT ID, post_title,post_name, post_content FROM " . $wpdb->posts . " WHERE post_status='static' AND ID < 19 ORDER BY menu_order ASC";
    }
    return $wpdb->get_results($query);
    }'

    Not a very great solution, but it Works fine for me.
    greetings
    Mazalien

  7. Scribe
    Member
    Posted 8 years ago #

    I've tried what Chriggi said and it removes the pages from the sidebar but not the top navigation bar.

    I have two pages I do NOT want across the top. Can someone give me the proper code to get rid of those two pages please? The page id numbers are 2 and 364. Also, where would I put the code.

    Everything else about this theme is great. If I can't remove those two pages, I'll have to look for another template and I don't want to do that.

    Please help.

  8. Scribe
    Member
    Posted 8 years ago #

    It's OK, I found the thread with the answer.

    http://wordpress.org/support/topic/41380

    Go down half a dozen posts and you'll see one written by Minna about adding one line of code to bx_functions.php, where indicated on the other thread. This is the code (just change the number to the id number of your page).

    elseif ($page_id == "364") {/*ignore*/}

    Note: This does not work for the page entitled "about", but it will get rid of other pages. I'll have to find another solution for my "About" page.

  9. Scribe
    Member
    Posted 8 years ago #

    Sorry, I'm not spamming, I'm sharing solutions as I find them.

    If you have a page called "about" and you don't want it to show in the top navigation bar, just remove the following from bx_functions.php.

    elseif($page_name == "about") {
    (is_page($page_id))?$selected = ' class="selected"':$selected='';
    echo "<li".$selected.">About\n";
    }

    and then add the following to the same place as mentioned in my previous post:

    elseif ($page_title == "about") {/*ignore*/}

    It took me four hours to work this out. I hope this helps someone else.

  10. Scribe
    Member
    Posted 8 years ago #

    :)

    I made a mistake, you have to make these changes in header.php NOT bx_functions.php.

  11. volatyle
    Member
    Posted 8 years ago #

    Thank you sooo much for that much help..the thing is

    "
    Parse error: parse error, unexpected T_ELSE in /home/volatyle/public_html/wp-content/themes/blix/header.php on line 69"

    I've read some replies to similar questions and I guess if all else fails I will have to manually upload my .php files.

  12. Mazalien
    Member
    Posted 8 years ago #

    What is the code on line 69 ?

  13. PDM
    Member
    Posted 8 years ago #

    I wanted to do a similar thing, and not include all the child pages in the main navigation. I made a new function in the BX_functions.php page, and then in the header file, replaced $pages = BX_get_pages(); with this new function $pages = BX_get_main_pages();

    The new function is below, which is the same as $pages = BX_get_pages(); except in the query I added and post_parent='0' which only gets the parent pages. Hope that helps someone.


    function BX_get_main_pages($with_content = '')
    {
    global $wpdb;
    $query = "SELECT ID, post_title, post_name FROM " . $wpdb->posts . " WHERE post_status='static' and post_parent='0' ORDER BY menu_order ASC";
    if ($with_content == "with_content") {
    $query = "SELECT ID, post_title,post_name, post_content FROM " . $wpdb->posts . " WHERE post_status='static' ORDER BY menu_order ASC";
    }
    return $wpdb->get_results($query);
    }

  14. raldana
    Member
    Posted 7 years ago #

    Hi,

    I've tried the PMD's tip in my site, http://www.ra1.com.br, and it works for me!

    Tks PMD!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags