WordPress.org

Ready to get started?Download WordPress

Forums

BuddyPress Activity Plus
[resolved] having links open in new / blank window (6 posts)

  1. ds123
    Member
    Posted 1 year ago #

    anyone know what i would need to modify in order to force the links that are shared to open in a new browser window instead of taking user away from the site ? thanks

    http://wordpress.org/extend/plugins/buddypress-activity-plus/

  2. yzqiang
    Member
    Posted 1 year ago #

    I need it too.

  3. ellbristow
    WPMU DEV Support Staff
    Posted 1 year ago #

    To have shared links open in a new window, you need to edit the file at

    /plugins/buddypress-activity-plus/lib/forms/link_tag_template.php

    There are two places where the tags are used, if you add target="_blank" to each you'll be good to go.

  4. stevenpreece
    Member
    Posted 1 year ago #

    I'm having the same problem. I looked at the file above and noticed that there is already one instance of target="_blank" but have no idea where a second should be?

    <?php
    $target = in_array(BPFB_LINKS_TARGET, array('all', 'external')) ? 'target="_blank"' : '';
    ?><div class="bpfb_final_link">
    	<?php if ($image) { ?>
    	<div class="bpfb_link_preview_container">
    		<a>" <?php echo $target; ?> ><img src="<?php echo $image; ?>" /></a>
    	</div>
    	<?php } ?>
    	<div class="bpfb_link_contents">
    		<div class="bpfb_link_preview_title"><?php echo $title;?></div>
    		<div class="bpfb_link_preview_url">
    			<a>" <?php echo $target; ?> ><?php echo $url;?></a>
    		</div>
    		<div class="bpfb_link_preview_body"><?php echo $body;?></div>
    	</div>
    </div>

    [Please post code & markup between backticks or use the code button. Your posted code has now have been permanently damaged by the forum's parser.]

  5. ellbristow
    WPMU DEV Support Staff
    Posted 1 year ago #

    Hi @stevenpreece,

    Your code was modified by wordpress when you posted it... but the two locations you are looknig at are the lines that contain <a href=" etc

    you need to add target="_blank" between the a and the href. That should get it working for you.

  6. madcap66
    Member
    Posted 7 months ago #

    Have a look at the code below and where the target="_blank" needs to go. Works for me:

    <?php
    $target = in_array(BPFB_LINKS_TARGET, array('all', 'external')) ? 'target="_blank"' : '';
    ?><div class="bpfb_final_link">
    	<?php if ($image) { ?>
    	<div class="bpfb_link_preview_container">
    		<a href="<?php echo $url;?>" <?php echo $target; ?> target="_blank"><img src="<?php echo $image; ?>" /></a>
    	</div>
    	<?php } ?>
    	<div class="bpfb_link_contents">
    		<div class="bpfb_link_preview_title"><?php echo $title;?></div>
    		<div class="bpfb_link_preview_url">
    			<a href="<?php echo $url;?>" <?php echo $target; ?> target="_blank"><?php echo $url;?></a>
    		</div>
    		<div class="bpfb_link_preview_body"><?php echo $body;?></div>
    	</div>
    </div>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.