Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 72705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:05:12+00:00 2026-05-10T20:05:12+00:00

I have a WordPress site (2.6.2) in which I have set the Home page

  • 0

I have a WordPress site (2.6.2) in which I have set the Home page to a static page instead of the normal posts page. The ID of this page is 2, so in the WordPress template I have changed the wp_list_pages to look like this:

<?php wp_list_pages('exclude=2&title_li=&depth=1' ); ?> 

this works fine, but now the Home page doesn’t get ‘lit up’ when it’s selected (because in fact it’s page_id 2 that is selected, and it doesn’t show in the menu). Is there any easy way around this?

If not, in broad outlines, what’s the hard way around this? Make my own version of the wp_list_pages function?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T20:05:12+00:00Added an answer on May 10, 2026 at 8:05 pm

    Setting a static page as the front page doens’t highlight the menu link, which is at the heart of the question.

    So, you could server-side customize (hack) the wp_list_pages function, but here’s a client-side option if you so choose:

    Use the jQuery library (conveniently it comes with WP 2.2+), call:

    wp_enqueue_script('jquery'); 

    or load your own version:

    wp_enqueue_script( 'jquery', '/path/to/your/jquery.js', false, '1.2.1'); 

    Now add a bit of javascript in your template, something like:

    if(window.location.href == 'http://www.example.com/'){ //checks for root path - 'home' ('http://www.example.com/?p=7' or 'http://www.example.com/2008-10/7' will not match)     jQuery('#nav > ul > li > a:first').addClass('current_page_item'); } 

    The a:first portion assumes the first link in your menu is the home/frontpage link. If it’s not, select via href value or position. Here’s by postion:

    ~~~~~~~~~~~~~~~

    jQuery(jQuery('#nav > ul > li > a')[3]).addClass('current_page_item'); //add 'current_page_item' css class so menu item highlighting occurs 

    Example:

    <div id=’nav’ >

    <ul >
    <li > <a >Link 0 </a > </li >
    <li > <a >Link 1 </a > </li >
    <li > <a >Link 2 </a > </li >
    <li > <a >Link 3 </a > </li >
    <li > <a >Link 4 </a > </li >
    <li > <a >Link 5 </a > </li >
    </ul >

    </div >


    Caveats:

    1. Check for the actual name of your menu div id (#nav shown here)
    2. A nested ul/li menu structure (so more than one level) will require additional code to properly selection the correct a element.
    3. If menu links are going to change, don’t use a positional selection technique, use another hook, like the href value of the link to the home/front page.
    4. The if(window.location.href == ‘http://www.example.com/‘) portion may need to be a regex if more variation is involved (https, multiple subdomains, etc).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 73k
  • Answers 73k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Why don't you use an inline helper function which gets… May 11, 2026 at 1:55 pm
  • added an answer The term was coined in Ted Neward's book 'Server-based Java… May 11, 2026 at 1:55 pm
  • added an answer This isn't easily explained in a StackOverflow post, particularly since… May 11, 2026 at 1:55 pm

Related Questions

I have a (Wordpress powered) website, and Google is indexing some of the sub-directories.
i have a wordpress blog and want to give people the same user experience
I have a friend who has code like this in his wordpress files: Blockquote
I'm starting a Wordpress Blog that will have adult content on it, so I'll
Is there any SEO disadvantage in using a subdomain to host a blog on
I have a relatively complex .htaccess file to control page requests, this currently redirects
I have developed a taxonomy for a site that I've been working on that
This is a specific variation on the can't connect problem. In my case, I've

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.