How assign current class at home page by core (1 post)

  1. alb
    Posted 9 years ago #

    The problem is not when I click on the item menu home, but when I open the first time the site;
    I use plugin Static Front Page for the home; but when I open the first time the site (in localhost)
    the home not have the current class.
    So I want to change the core, the template-functions-post.php (row 416 about)

    This is the code:
    $css_class = 'page_item';
    1- if ( $page_id == $queried_obj->ID )
    2- $css_class .= ' current_page_item';

    $output .= $indent . '<li class="' . $css_class . '">#a href="' . get_page_link($page_id) . '" title="' . wp_specialchars($title) . '">' . $title . '#/a>';

    the row 1 and 2 when I have home page not work;
    If I add this code:
    $css_class = 'page_item';
    1- if ( $page_id == $queried_obj->ID )
    2- $css_class .= ' current_page_item';
    3 if (is_home())
    $css_class .= ' current_page_item';

    It insert the class current_page_item on all the item and not only in the home page;

    Any solutions?

    This is is the solution that I not want use because the home page isn't more inner the list but external
    <?php if (is_home()): ?>
    <li class="current_page_item">;
    <?php wp_list_pages('title_li='); ?>
    <?php else : ?>

  2. #/a>#/a>
  3. #/a><?php wp_list_pages('title_li='); ?>
    <?php endif; ?>#/a>#/a>

    (I use # only how sobstitute > or < that change the format of the post)

Topic Closed

This topic has been closed to new replies.

About this Topic