BuddyDev

Search

Open a link in a new window or tab with BP Custom Group Tabs plugin ?


  • Participant
    Level: Initiated
    Posts: 18
    Eric LUCAS on #25265

    Hello, how is it possible to do that please ? (for internal links or external links)
    Thanks


  • Keymaster
    (BuddyDev Team)
    Posts: 12238
    Brajesh Singh on #25281

    Hi Eric,
    Opening a link in new tab needs the target attribute to be added on the link. The tab links(main tab) are managed by BuddyPress and we can not add the target attribute.

    The only way to do it will be to use js to modify the links.

    For sub navs in group, we create the links, so we can provide a way to do it.

    Please let me know if you want to go with js and I will assist. It will need modification in your theme’s js.

    Regards
    Brajesh


  • Participant
    Level: Initiated
    Posts: 18
    Eric LUCAS on #25284

    Hello, thanks a lot, yes I would like to… However, it’s not for sub nav but for primary nav…

    I’ve tried also a plugin supposed to open any external link in a new tab, but it does not work…

    Thanks!


  • Participant
    Level: Initiated
    Posts: 18
    Eric LUCAS on #25285

    P.S. I want to open this page, which is not external, in a new window : https://autistance.org/groups/org-aut_allianceautiste-org_orgintl_onu-cdph/allianceautiste-org_orgintl_onu-cdph_audio-video/

    This is only an example and there will be more in the future.


  • Participant
    Level: Initiated
    Posts: 18
    Eric LUCAS on #25289

    P.S.2 I installed the version 2 of that plugin (WP New Window) and added the CSS classes of the button (BBB) but no way, it never wants to open in a new tab. And could not find how to open a specific link (not the button) in a new tab in this plugin.

    Anyway it would be nice if there was a checkbox “open in a new window” in your plugin, like it is in the regular WP menus and even in menu plugins (like MegaMax).


  • Keymaster
    (BuddyDev Team)
    Posts: 12238
    Brajesh Singh on #25292

    Hi Eric,
    In order to let browser open links in new tab automatically, we need to set the ‘target’ attribute. The problem is we do not have control over that. We register our items and BuddyPress generates the links.

    That’s why we can not add the open in new tab.

    The work around is using javascript. Which is not good enough to be part of the core plugin.

    I or @ravisharma will share some code to open tabs in new window in next 2 days.

    Thank you
    Brajesh


  • Participant
    Level: Initiated
    Posts: 18
    Eric LUCAS on #25298

    Hello, thank you so much 🙂
    I hope you will also give me a link to a page explaining where and how to put that code (I’ve never done that, I always rely on plugins). Thanks !

You must be logged in to reply to this topic.

This topic is: not resolved
Subscribe