Skip to:
Content
Pages
Categories
Search
Top
Bottom

Problems with active state menu for Homepage/Activity

  • Profile photo of gian-ava
    gian-ava
    Participant

    @gian-ava

    I run single WP with BP Template Pack, and I set up Activity stream in Settings > Reading as Front page.

    So I got activity stream on my homepage.

    Unfortunately, I cannot get the active state fot the Home menu button to display, because the following statement doesn’t print class=”active” in the list item.

    <li <?php if ( is_front_page() || bp_is_front_page() || bp_is_page( BP_ACTIVITY_SLUG ) ) { echo 'class="active"'; } ?> id="home-nav"><a href="<?php echo get_settings('home'); ?>" alt="Home">Home</a></li>

    If I type http://cureuphoria.com/activity, than it prints it, because of the bp_is_page( BP_ACTIVITY_SLUG ) function.

    But http://cureuphoria.com, the homepage, is not recognized from is_front_page() and bp_is_front_page().

    Any hints?

Viewing 25 replies - 1 through 25 (of 29 total)
  • Profile photo of gian-ava
    gian-ava
    Participant

    @gian-ava

    It kills me when something SO basic doesn’t work!

    Profile photo of gian-ava
    gian-ava
    Participant

    @gian-ava

    So, nobody willing to spend a couple of minutes on this, at least to tell me if the code SHOULD do its job?

    Logically it should. But it doesn’t.

    Profile photo of @mercime
    @mercime
    Moderator

    @mercime

    Hi gian-ava . Try this assuming your active link is .active

    <li<?php if ( bp_is_front_page() ) : ?> class="active"<?php endif; ?>>
    <a href="<?php echo site_url() ?>" title="<?php _e( 'Home', 'buddypress' ) ?>"><?php _e( 'Home', 'buddypress' ) ?></a>
    </li>

    Profile photo of gian-ava
    gian-ava
    Participant

    @gian-ava

    Thanks for the reply, mercime!

    Nope, that doesn’t do it. The class “active” is not printed.

    This is really weird, isn’t it?

    Profile photo of jivany
    jivany
    Participant

    @jivany

    Did you try is_home() instead?

    https://codex.wordpress.org/Conditional_Tags

    The above link suggests that it should be is_front_page() but given how bp-default is playing around with that setting in the backened, you might need to check is_home()

    Profile photo of gian-ava
    gian-ava
    Participant

    @gian-ava

    @jivany Usually is_home() is for the blog index page.

    And I got that on the menu, and is working fine with the blog index page.

    I can’t believe something so basic doen’t work.

    I am really scratching my head off on this.

    Profile photo of jivany
    jivany
    Participant

    @jivany

    Yup, I know is_home() is for the blog page. What I was suggesting was that since is_front_page() doesn’t work (which it should) so maybe try is_home() and see if something isn’t setup properly.

    I’m assuming you didn’t create a new page template called “Activity Stream”. In the bp-default functions.php, there are a number of functions that inject the “Activity Stream” option into the drop down box for static “Front Page”. My thought is that this method isn’t setting up something completely so the standard template tags aren’t working.

    Profile photo of gian-ava
    gian-ava
    Participant

    @gian-ava

    @jivany Are you suggesting I’d create a tempalte file called Activity and set the front page to that.

    If so, should I copy all the stuff from “activity/index.php” into that template file?

    That could be a solution, but more of a workaround than a fix, right?

    Profile photo of jivany
    jivany
    Participant

    @jivany

    Not sure what this template conditional does but maybe it’s the one we’re missing. ;)

    bp_is_activity_front_page()

    https://codex.buddypress.org/developer-docs/conditional-template-tags/

    Profile photo of gian-ava
    gian-ava
    Participant

    @gian-ava

    Is there anyone that have the slighest idea why this doesn’t work?

    By this, I mean “bp_is_front_page()” not being recognized.

    Profile photo of gian-ava
    gian-ava
    Participant

    @gian-ava

    @jivany Nope, “bp_is_activity_front_page” doesn’t work neither.

    I am on WP single with WP Tempale Pack.

    I got the Front page set to Activity stream.

    I tried:

    1) bp_is_front_page

    2) is_front_page

    3) bp_is_page(BP_ACTIVITY_SLUG)

    4) bp_is_activity_front_page

    Neither of those work on the homepage.

    I can’t get anything printed out of a conditional statement with the above, meaning I can’t have a “Home” menu highlighted.

    Anybody who got this problem?

    Profile photo of jivany
    jivany
    Participant

    @jivany

    Open a ticket. There’s something wrong. Make sure you provide as

    much detail as possible

    Profile photo of @mercime
    @mercime
    Moderator

    @mercime

    Hmm, perhaps it would be better to add the WP regular home/front page conditions to the mix, have not used template pack before in project.

    .

    <li><?php if ( is_home() || is_front_page() || bp_is_page( 'home' ) || bp_is_front_page() ) : ?> class="active"<?php endif; ?>><a href="<?php echo get_option('home') ?>" title="<?php _e( 'Home', 'buddypress' ) ?>"><?php _e( 'Home', 'buddypress' ) ?></a></li>

    Profile photo of gian-ava
    gian-ava
    Participant

    @gian-ava

    @mercime I”l try that… Will let you know.

    Profile photo of gian-ava
    gian-ava
    Participant

    @gian-ava

    Well, the only one I didn’t test was bp_is_page( ‘home’ ).

    And it doesn’t work neither.

    It’s not logical.

    Profile photo of gian-ava
    gian-ava
    Participant

    @gian-ava

    I’ve tried to activate the default theme. Same thing,” bp_is_front_page()” is not recognized.

    Tried also to deactivate all plugins (except BP). Nothing.

    What the hell! Will I ever have an highlighted menu for home when on the homepage?

    Profile photo of jivany
    jivany
    Participant

    @jivany

    @gian-ava: Again, open a ticket. It sounds like there is a problem that needs to be fixed.

    Profile photo of jivany
    jivany
    Participant

    @jivany

    @gian-ava: Again, open a ticket. It sounds like there is a problem that needs to be fixed.

    Profile photo of 21cdb
    21cdb
    Participant

    @21cdb

    Are you running BP-Trunk?

    https://trac.buddypress.org/ticket/2260

    Profile photo of 21cdb
    21cdb
    Participant

    @21cdb

    Are you running BP-Trunk?

    https://trac.buddypress.org/ticket/2260

    Profile photo of gian-ava
    gian-ava
    Participant

    @gian-ava

    @21cdb Looks like your link explain my problem. Just… what is BP Trank. In your lijk they talk about “running a trunk”.

    Profile photo of gian-ava
    gian-ava
    Participant

    @gian-ava

    @21cdb Looks like your link explain my problem. Just… what is BP Trank. In your lijk they talk about “running a trunk”.

    Profile photo of jivany
    jivany
    Participant

    @jivany

    Trunk is the base SVN version. If you’re grabbing BP via SVN then you’re getting whatever is on the trunk. If you’re downloading BP via the regular channels (direct download from teh BP home page or via WP plugins), you have a released version.

    Profile photo of jivany
    jivany
    Participant

    @jivany

    Trunk is the base SVN version. If you’re grabbing BP via SVN then you’re getting whatever is on the trunk. If you’re downloading BP via the regular channels (direct download from teh BP home page or via WP plugins), you have a released version.

    Profile photo of gian-ava
    gian-ava
    Participant

    @gian-ava

    Thanks jivany! I see. Anyway, I’ve installed BP from the plugins panel in WP admin. So it is a released version.

    I am amazed that nobody else got this problem. If it’s in the release version, how can I be the only one having or complaining about this?

Viewing 25 replies - 1 through 25 (of 29 total)
  • The topic ‘Problems with active state menu for Homepage/Activity’ is closed to new replies.
Skip to toolbar