Blogs Directory - Feature Request - Open in New Window

It would be great if there were a feature that controls how the blog links are opened. I would like to have the blogs open in a new tab/window.

In the meantime, is there some CSS code that I could add to the Directory page to open all links in new tabs?

Thanks,
Chris

  • Vaughan

    Hi Chris,

    Hope you're well?

    I can certainly add this to the features & feedback section to see how popular this is and hopefully the developers will look into it for a future release.

    In the meantime, you can do this by editing the plugin code.

    Open blogs-directory.php

    Find the following lines (around lines 430 - 436)

    if ( function_exists('get_blog_avatar') ) {
    								$content .= '<td style="background-color:' . $bg_color . '; padding-top:10px;" valign="top" width="10%"><center><a style="text-decoration:none;" href="http://' . $blog['domain'] . $blog['path'] . '">' . get_blog_avatar($blog['blog_id'], 32, $avatar_default) . '</a></center></td>';
    							} else {
    								$content .= '<td style="background-color:' . $bg_color . '; padding-top:10px;" valign="top" width="10%"></td>';
    							}
    							$content .= '<td style="background-color:' . $bg_color . ';" width="90%">';
    							$content .= '<a style="text-decoration:none; font-size:1.5em; margin-left:20px;" href="http://' . $blog['domain'] . $blog['path'] . '">' . $blog_title . '</a><br />';

    Then add target="_blank" to the anchor tags.

    if ( function_exists('get_blog_avatar') ) {
    								$content .= '<td style="background-color:' . $bg_color . '; padding-top:10px;" valign="top" width="10%"><center><a style="text-decoration:none;" target="_blank" href="http://' . $blog['domain'] . $blog['path'] . '">' . get_blog_avatar($blog['blog_id'], 32, $avatar_default) . '</a></center></td>';
    							} else {
    								$content .= '<td style="background-color:' . $bg_color . '; padding-top:10px;" valign="top" width="10%"></td>';
    							}
    							$content .= '<td style="background-color:' . $bg_color . ';" width="90%">';
    							$content .= '<a style="text-decoration:none; font-size:1.5em; margin-left:20px;" target="_blank" href="http://' . $blog['domain'] . $blog['path'] . '">' . $blog_title . '</a><br />';

    Alternatively, though I haven't tried this, you could try changing it by adding the following JQuery in your theme footer.php

    <script type="text/javascript">
    jQuery(document).ready(function(){
      jQuery('.blogs_directory_table a').attr('target', '_blank');
    });
    </script>

    The above should add target="_blank" to all links inside the blogs_directory_table class.

    Hope this helps

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.