WordPress.org

Forums

[resolved] Custom Theme Problem (23 posts)

  1. DarkGashX
    Member
    Posted 8 years ago #

    I have a custom theme at my website and it's all great but for some reason if I click the category "Television Shows" or "Video Games" on the right it highlights "Gamercard Generator" and "About Me" at the top as if we/you are viewing that page... but we/you are not!

    I'm really stumped and I would like some help if possible :).

    My Site: http://www.darkgashx.com .

  2. DarkGashX
    Member
    Posted 8 years ago #

    I forgot to add, the code I am using for the navigation bar is:

    <li class="<?php if (is_home()) { ?>current_page_item<?php } else { ?>page_item<?php } ?>">
    /">
    <?php _e('Home',TEMPLATE_DOMAIN); ?>

    <?php wp_list_pages('sort_column=menu_order&depth=1&title_li='); ?>

    and on the sidebar for the categories:

    <?php wp_list_categories('sort_column=name&show_count=1&title_li=&hierarchical=1&feed=RSS&feed_image='.get_bloginfo('stylesheet_directory').'/images/icons/feed-iconsmall.gif'); ?>

    Hope that helps someone to help me.. if that makes sense (lol).

  3. Mauricio Caballero
    Member
    Posted 8 years ago #

    I have the same problem =(
    somebody has the answer? please! :)

    P.D. In this topic also they have the same problem
    http://wordpress.org/support/topic/104401?replies=1

    Even in theme 'default' if I add this at the end of the file style.css

    #sidebar ul li.current-cat a {color:#FF0000;}
    #sidebar .pagenav ul li.current_page_item a {color:#FF0000;}

    If the ID page is the same ID of the category is highlighted both

  4. DarkGashX
    Member
    Posted 8 years ago #

    I guess it's a WP bug as no one has any answers mate.

  5. DarkGashX
    Member
    Posted 8 years ago #

    Can any WP coder or staff confirm this bug?

  6. DarkGashX
    Member
    Posted 8 years ago #

    Infected-FX any luck? This is bugging me now :(.

  7. Root
    Member
    Posted 8 years ago #

    This is not a WP *bug* as if there ever were such a thing. It is theme dependent. Do I know the answer? Sorry. No I don't.

  8. DarkGashX
    Member
    Posted 8 years ago #

    Oh, just kind of strange as it only happens with categories and if they have the same ID as a page.

  9. vkaryl
    Member
    Posted 8 years ago #

    It's always been a bad idea to name cats same as pages or vice versa. Can break all sorts of things, as you seem to have discovered.

  10. DarkGashX
    Member
    Posted 8 years ago #

    No no, the same ID (i.e. 1, 2, 3 etc). You can't change that.

  11. sadish
    Member
    Posted 8 years ago #

    I did check the WP code that gets executed when using wp_list_categories and is not causing any issue with wp_list_pages.
    are you using wp_list_categories ?

  12. DarkGashX
    Member
    Posted 8 years ago #

    Yes I am, here is my code:

    <?php wp_list_categories('sort_column=name&show_count=1&title_li=&hierarchical=1&feed=RSS&feed_image='.get_bloginfo('stylesheet_directory').'/images/icons/feed-icon-10x10.gif'); ?>

  13. sadish
    Member
    Posted 8 years ago #

    This is really really strange and I dont know what causes the wp_list_pages to emit "class=current_page_item" while it is not the current page really.

    This suggestion might sound stupid, but try it anyway.
    change your ul class="menu" to ul id="menu" and change your stylesheet to have #menu instead of .menu

    also move the #menu styles to be above #sidebar styles.

    see it if it helps.

  14. DarkGashX
    Member
    Posted 8 years ago #

    No luck for me, so I reverted it back. This is real weird, I don't understand it :s. Does the WP team post on here?

  15. vkaryl
    Member
    Posted 8 years ago #

    Meaning the devs? No. You might want to hit http://lists.automattic.com/, and check out/sign up for the hackers list.

  16. DarkGashX
    Member
    Posted 8 years ago #

    Oh, well I'm not sure on what to do. You can see what I mean here: http://www.darkgashx.com . Click Television Shows on the right and you will see a nav option at the top gets highlighted.

  17. DarkGashX
    Member
    Posted 8 years ago #

    Ok It is because of the categories and their ID's. For instance:

    If you have a category with ID 2 and a page with ID 2 it highlights the page in the navigation bar with id 2 when selecting the category with ID 2. Seems there is some kind of conflict?

    It is a WordPress bug without a doubt.

    How do I submit this as a bug?

  18. Chris_K
    Member
    Posted 8 years ago #

    http://trac.wordpress.org/

    Include details on how to reproduce it!

  19. DarkGashX
    Member
    Posted 8 years ago #

    Done, thanks.

  20. This might be worth a try:

    In wp-includes/classes.php, right around line 509, you'll find this code:

    $css_class = 'page_item';
    $_current_page = get_page( $current_page );
    if ( $page->ID == $current_page )
    	$css_class .= ' current_page_item';
    elseif ( $_current_page && $page->ID == $_current_page->post_parent )

    Try changing it to this:

    $css_class = 'page_item';
    $_current_page = get_page( $current_page );
    if ( $page->ID == $_current_page->ID )
    	$css_class .= ' current_page_item';
    elseif ( $_current_page && $page->ID == $_current_page->post_parent )

    The difference is subtle. :)

    OLD: if ( $page->ID == $current_page )
    NEW: if ( $page->ID == $_current_page->ID )

    See? :D

  21. DarkGashX
    Member
    Posted 8 years ago #

    My site has gone down I will try it later. Thabks.

  22. DarkGashX
    Member
    Posted 8 years ago #

    Sorry, didn't work :(.

  23. DarkGashX
    Member
    Posted 8 years ago #

    WOO! 2.1.1 fixes it, I reported it only a few days ago and they fixed it! Thanks WP Team! :).

Topic Closed

This topic has been closed to new replies.

About this Topic