How do I set to open links in new window?

Links open in same window taking user out of website. How can I set to open in new window?

    Nick
    • 89
    • #1,364

    Alternatively, you can set links to open in a new window manually by using the "target" attribute when you build your link. For instance, your link might look like:

    <a href="http://google.com" target="_blank">

    EDIT: If you are comfortable editing the plugin itself to do this automatically, you can follow these steps (assuming plugin version 1.5) - remember to always back everything up in case something fails along the way:

    1. Go to: wp-content/plugins/buddypress-activity-plus/lib/bpfb_group_documents.php
    2. Find the line 187: '<a href="' . bp_get_group_permalink($group) . '">' . bp_get_group_name($group) . '</a>'
    3. Change to: '<a href="' . bp_get_group_permalink($group) . '" target="_blank">' . bp_get_group_name($group) . '</a>'

    Nick

    Taye
    • 27
    • #4,878

    @Nick are you sure this line of code is in: wp-content/plugins/buddypress-activity-plus/lib/bpfb_group_documents.php ? I cannot find it.

    Nick
    • 89
    • #1,364

    @Taye - Yep! If you're using a text editor, you can search the document for this comment: Creates the activity info message. - the code that's referenced in the previous post is in the function directly following this comment. I've taken a screenshot and highlighted the code for your reference.

    Let me know if you still can't find it.

    - Nick

    Patrick

    Hi again @Taye

    Have the suggestions provided here help you to resolve your issue?

    Taye
    • 27
    • #4,878

    I changed the code but Activity Plus links still open in same window. very odd. Screen shot of target=blank attached. Very odd. What should I try next?

    Nick
    • 89
    • #1,364

    Taye,

    Any way you could post a public link to your site so we can investigate?

    Thanks,
    Nick

    Taye
    • 27
    • #4,878

    http://www.youngwomeninenergy.com/test/

    The activity page drops down from the "Members Only" menu tab - It is called "In the Know". Because it is a members site, access is limited. I can send login member credentials if it will be helpful.

    Also - we have not set up Groups - not sure if that makes a difference or not.

    Patrick

    Hi again @Taye

    I took a look in images_tag_template.php and link_tag_template.php and, lo and behold, there is a constant referenced there that you can override to open external links in a new window.

    Simply add the following to your wp-config.php file:

    define('BPFB_LINKS_TARGET', true);

    I'm going to update the usage docs with this too... now that I know about it :)

    Taye
    • 27
    • #4,878

    Can you be more specific about where to add the code in the wp-config.php file? I don't know html code. Is this part of the plugin code? Will there be a plugin update coming? Diddling with the code makes me very nervous.

    Patrick

    @Taye

    The wp-config.php file is the same file you would have edited when you first installed WordPress on your site to add your database name, username and password.

    It is in your wp-content folder that you can access either via FTP or, if you use cPanel at your host, you can use the File Manager feature.

    You would need to open wp-config.php in a text editor (not a word processing program like MS Word as that adds formatting that would render the code useless, and likely mess up other things too).

    Add the code above just before the line that says
    "That's all, stop editing".

    Then save and re-upload the file.

JOIN 378558 HAPPY MEMBERS

We pride ourselves on our level of customer support and responsiveness to member requests. Your WordPress experience will never be the same


Become a member

  • PayPal Partner