• Hey. I’ve been working on this for the past two days and cannot figure it out for the life of me. I would like to add a page to my header that points to /wp-gallery2.php

    First, my site: https://pbriscoe.com

    This is the code I have entered into my header.php


    <?php if (is_page()) { $highlight = ""; } else {$highlight = "current"; } ?>
    <div id="mainmenu">
    <ul class="level1">
    <li class="<?php echo $highlight; ?>"><a>"><?php _e('Home','andreas09'); ?></a>
    <li class=""><a href="/wp-gallery2.php">Gallery</a>
    <?php
    if(function_exists("wp_andreas09_nav")) {
    wp_andreas09_nav("sort_column=menu_order&list_tag=0&show_all_parents=1&show_root=1");
    }
    ?>
    </div>

    This has made the page, and it works when I click on it, however, it does not become highlighted, “Home” remains highlighted instead. I am trying to accomplish 2 things. 1) make is so when I click on the page (“Gallery”) it highlights and “Home” un-highlights. 2) I would like to be able to alter the page order. e.g. Make Gallery the third link rather than the second. Can’t figure this out since “Gallery” isn’t an actual page.

    If anyone has any ideas on how to fix these issues, I would greatly appreciate it. Thank you!! :)`

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter lul2x

    (@lul2x)

    Anyone. I figure it can’t be too difficult, I just have no idea what I’m missing.

    You always serve the gallery-li without highlighting:

    <li class=””>

    Thread Starter lul2x

    (@lul2x)

    What should I change it to? If I use this code…

    <li class="<?php echo $highlight; ?>">

    the same thing happens. Do I need to add something else to class?

    You are testing if the actual page is a page, try something like

    if (is_home()) $highlight1=”current”; elseif (!is_page()) $highlight2=”current”;

    Use higlight1 for the class in home
    Use higlight2 for the class in gallery

    Thread Starter lul2x

    (@lul2x)

    I’m sorry for being such a newb, but I’m not sure exactly what you mean. This is what I tried, and the same results happened.

    <?php if (is_home()) $highlight1="current"; elseif (!is_page()) $highlight2="current"; ?>
    <div id="mainmenu">
    <ul class="level1">
    <li class="highlight1"><a href="<?php echo get_settings('home'); ?>"><?php _e('Home','andreas09'); ?></a></li>
    <li class="highlight2"><a href="/wp-gallery2.php">Gallery</a></li>
    <?php
    if(function_exists("wp_andreas09_nav")) {
    wp_andreas09_nav("sort_column=menu_order&list_tag=0&show_all_parents=1&show_root=1");
    }
    ?>

    I’m not sure if that’s what you were saying or not.

    Yes, but you forgot the $ before highlight

    Thread Starter lul2x

    (@lul2x)

    Hmm, I added the $ before both highlights. Now, neither Home nor Gallery will highlight when clicked. The other pages are still working fine. You can take a look at what I mean at https://pbriscoe.com

    Here is my current code:

    <?php if (is_home()) $highlight1="current"; elseif (!is_page()) $highlight2="current"; ?>
    <div id="mainmenu">
    <ul class="level1">
    <li class="$highlight1"><a href="<?php echo get_settings('home'); ?>"><?php _e('Home','andreas09'); ?></a></li>
    <li class="$highlight2"><a href="/wp-gallery2.php">Gallery</a></li>
    <?php
    if(function_exists("wp_andreas09_nav")) {
    wp_andreas09_nav("sort_column=menu_order&list_tag=0&show_all_parents=1&show_root=1");
    }
    ?>
    </div>

    Thread Starter lul2x

    (@lul2x)

    Anymore ideas out there?

    Thread Starter lul2x

    (@lul2x)

    bump

    Thread Starter lul2x

    (@lul2x)

    bump

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Custom Page w/ Highlight’ is closed to new replies.