Forums

[Plugin: Page Links To] verify fuction current_item (4 posts)

  1. discipolo
    Member
    Posted 7 months ago #

    just to verify:
    i installed version 1.6 of the page-links-to plugin.

    on the plugin website it says:
    1.2 If you link to an internal WordPress page, like a category, the menu item will get the current_item CSS class when you’re on that page

    on my site, regardless of the theme i activate, the real pages get the current_page_item class

    as far as i understand the code shouldnt this be replaced by a current_item class?

    and for what reason dont the categories i link to get anything like that. (i thought they would turn up as current_pages to?)

    now i would greatly prefer to just "manually" adjust the navigation. but since that would mean i cannot simply change the theme i suppose using this plugin would suffice.

    so if anybody could tell me if this actually should work with highlits i can continue searching for whatever mistake i made.
    thanx alot
    D

  2. admc2
    Member
    Posted 7 months ago #

    Hello,

    I had the same problem, take a look at page-links-to.php, line 154 and line 168. At 154 you can see how a local link should look like in order to recognize it. I put into the condition a "$_SERVER['REQUEST_URI']==$page || ", for the relative URIs.

    At 168-169 there is the replace thing. If you shot a Ctrl-U on your site, you may see something different that it expects. For me it was <li class="page_item page-item-25"> for example, so, the page ID was included. So you may store the current_page_id: insert "$current_pag_id=$id;" to line 157. Then replace 169 to something like this:

    $pages = str_replace( '<li class="page_item page-item-'.$current_page_id.'"><a href="' . $current_page . '"', '<li class="page_item page-item-'.$current_page_id.' current_page_item"><a href="' . $current_page . '"', $pages );

    Hope this helps,
    Adam

  3. xeyefex
    Member
    Posted 5 months ago #

    didn't get it Adam...
    it only messed up my code, anyway to address this without hacking the core?

    if not how about a more accurate explanation?

  4. danbranigan
    Member
    Posted 2 months ago #

    Can anyone provide a clearer explanation of the "fix" that Adam has suggested above? I'm having the same problem.

    Cheers

    Dan

Reply

You must log in to post.

About this Topic