WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: The Events Calendar] current_page_item weirdness (5 posts)

  1. alvarix
    Member
    Posted 2 years ago #

    TEC 2.0.4

    A common thing we do is to have pages in our nav redirect to category pages produced by the events calendar plugin.
    Redirect eg. at top of header.php:

    $loc = "http://";
    $loc .= $_SERVER['SERVER_NAME'];
    if(is_page('Page Name')) {
       $loc .= "/events/category/cat/upcoming/";
       header( "Location: $loc" ) ;
    }

    This has worked well enough on previous sites.
    We would write some css to spoof the .current_page_item in the nav.

    On our current site, for some reason WordPress is thinking that other pages are the current page. It is adding .current_page_item and .current_page_ancestor to seemingly random pages.

    The site is not public at the moment, but selective access can be granted.

  2. roblagatta
    Modern Tribe Support
    Posted 2 years ago #

    Hey Alvar. Thanks for posting here; per our email exchange, I've got a dev looking at this now (and have shared the creds you provided via email). I expect you'll get a response no later than tomorrow.

  3. Joey Kudish
    Member
    Posted 2 years ago #

    Hi Alvarix,

    I'm the dev that Rob asked to look at the site. Apologies about the delay in getting back to you.

    I've taken a look at your site, but there's nothing that comes to mind right away as to why this would be occurring and it's not a behaviour I have seen before. My best guess is there some kind of conflict with your theme or another plugin.

    I realize your theme and all of your plugins are what make the site work, but since you are still under development, perhaps you can try disabling each plugin one at a time, as well as switch back to the twenty eleven default theme, and determine if one of them is the culprit. If you find out which one, then we might be able to help out further with debugging and troubleshooting.

    Sorry I can't be of more help, but it's definitely hard to diagnose an issue like with many variables and just by looking at it :)

    PS: a much more "WordPress" friendly way to the redirect you did above would be:

    if ( is_page('Page Name') ) {
    	wp_redirect( site_url('/events/category/cat/upcoming/') ); exit;
    }

    It's a little bit cleaner and less prone to errors/issues.

    Cheers
    Joey

  4. alvarix
    Member
    Posted 2 years ago #

    Hi Joey,

    Even without the redirects we still get the weirdness.

    My best guess is that it has something to do with how wordpress tries to guess your page if you have a typo in the pagename.

    Though, the classes it adds don't seem to be logical.
    Ie, sometimes it add current_page_item, other times current_page_ancestor, without any current_page_item below.

    For the moment I am just removing the classes with jQuery, but it is definately a head scratcher.

    I couldnt turn up anything in the codex about how wordpress applies the nav classes.

  5. Joey Kudish
    Member
    Posted 2 years ago #

    Hey alvarix,

    I agree with you, it's definitely strange. That being said, this isn't something we've heard from other users, so I still suspect a conflict with your theme or another plugin.

    Good luck,
    Joey

Topic Closed

This topic has been closed to new replies.

About this Topic