• For all the Blix enthusiast:

    As you know one of the coolest things about Blix is that you can create pages, that will display as css navigation buttons on the top of your site. I wanted to do the same trick on another theme. The problem was though, all the sub-pages are not that appealing. So I edited out the sub menu and instead modified a Bx_function to help create sub-pages navigation in the side bar. Sound interesting?

    Well, I’m not the greatest coder…so my code may need a lot of refining. And I would have posted on a more central location…but this site is so huge, I didn’t know where to post (I finally decided to post here).

    Lastly before I post the hack, I suspect that there are other hacks similar to this one floating out there. But either no one is posting them, or I just can’t find it (believe me I looked).

    1) The first thing I did was add a function to BX_functions.php . Well, it’s not quite an addition as much as it is a modification.

    function BX_get_pages_sub($page_name)
    {
    global $wpdb;
    global $page_id;
    $query = "SELECT ID, post_title, post_name FROM " . $wpdb->posts . " WHERE post_parent ='".$page_id."' ORDER BY menu_order ASC";

    return $wpdb->get_results($query);
    }

    I use this to separate the sub page results I added to the sidebar (I’ll get to that shortly).

    2) Then I add my modified code into header.php of the theme I want to modify (note: I used a theme where I could insert a vertical menu easily. i.e. – daisy ray gemini or gespa).

    A) the first modification must go inside the html head tag:

    <?php require_once get_template_directory()."/BX_functions.php"; ?>

    B) the second bit of modified code goes in the html body where ever you want to put it. But you have to make sure that you encompass the code with a ul tag. (using daisy rae you can put it in place of where it says link1 link2 etc.).

    Now you have a working nav bar without all the sub pages ??

    The next thing I did was to get rid of the “Pages” link in sidebar.php . Why? Well because that’s a lot of pages for a person to have to read at once. I just wanted something simpler. So I replaced it with a sub navigation system that would display only the current page and whatever sub pages exist. (note: it’s best to place it just under the “sidebar” div tag).

    <div id="subNavContent">
    <fieldset>
    <legend><span><a>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></span></legend>

    <ul>
    <?php
    $pages = BX_get_pages_sub($page->ID);

    if ($pages) {
    foreach ($pages as $page) {
    $page_id = $page->ID;
    $page_title = $page->post_title;
    $page_name = $page->post_name;
    if ($page_id == 1) {
    break;
    }
    (is_page($page_id))?$selected = ' class="selected"':$selected='';
    echo "<li ".$selected."><span><a title='".$page_title."'>$page_title</a></span>n";

    }
    }
    ?>
    </ul>
    </fieldset>
    </div>

    I know there is an error in the xhtml validation for the sidebar. So if anyone want to try to figure it out.. ??

    Well, there you have it. I hope someone likes it ??

Viewing 1 replies (of 1 total)
  • I tried your hack, but I think I am the hack. I’m new to WP and php, so maybe that’s why. Here’s my problem…

    I am using the Blix Redux v theme. See site at https://www.sdlp.us.

    When I add a child page, as you know, it is added to the horizontal navigation bar. I want to do what you have outlined above. There are major pages I want in the navigation bar and then there are minor pages I want as links in the sidebar (not the headings under SDLP Information). If I could not have the new pages added to the nav bar and simple link to the child pages, that would be great.

    I noticed there is this exclusion section in the BX_functions.php file:

    /**

    * Function BX_excluded_pages()

    * ——————————————————

    * Returns the Blix default pages that are excluded

    * from the navigation in the sidebar

    *

    */

    function BX_excluded_pages()

    {

    $pages = BX_get_pages();

    $exclude = “”;

    if ($pages) {

    foreach ($pages as $page) {

    $page_id = $page->ID;

    $page_name = $page->post_name;

    if ($page_name == “archives” || $page_name == “about” || $page_name == “about_short” || $page_name == “contact”) {

    $exclude .= “, “.$page_id;

    }

    }

    $exclude = preg_replace(“/^, (.*?)/”,”\\1″,$exclude);

    }

    return $exclude;

    }

    Being new to php, how would I make this part of the code work? Your help would be greatly appreciated. Tx.

Viewing 1 replies (of 1 total)
  • The topic ‘Blix menu hijacked!’ is closed to new replies.