WordPress.org

Ready to get started?Download WordPress

Forums

Business Directory Plugin
[resolved] Open Website Links In New Window (8 posts)

  1. atrixdave
    Member
    Posted 1 year ago #

    I need the website links on my listings to open in a new window/tab. I can't seem to figure out how to do this. I am fine with manipulating some code, just need to know where.

    Thanks!

    Dave

    http://wordpress.org/extend/plugins/business-directory-plugin/

  2. businessdirectoryplugin
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Dave,

    This is already possible in 3.0.2. When you make a field of type URL, simply check "open in a new window" inside Manage Form Fields for that field.

    You can also make it nofollow if you like as well.

  3. atrixdave
    Member
    Posted 1 year ago #

    Excellent! Thank you and I apologize for the dumb question :)

  4. rbwawpl
    Member
    Posted 10 months ago #

    Hi

    What if I want the single listing's page to be open in a new window/tab?
    F.e. after clicking listing title or thumbnail in excerpt?

    PaweĊ‚

  5. businessdirectoryplugin
    Member
    Plugin Author

    Posted 10 months ago #

    Hi Pawel,

    Right now, we don't have a configuration option for that. The listing detail views will open in the same window. URL fields that you define on the listing can support the new window/same window link setting above.

  6. rbwawpl
    Member
    Posted 10 months ago #

    Hi

    Thanks for your reply. Is there any way to modify one of the files to get the same result? Add target="_blank" somewhere?

  7. businessdirectoryplugin
    Member
    Plugin Author

    Posted 10 months ago #

    Yes, I'm sure there is. I'll have to ask my developer specifically where, but he's unavailable for a few days. I'll let you know when I hear back.

  8. businessdirectoryplugin
    Member
    Plugin Author

    Posted 10 months ago #

    OK, he responded more quickly than I thought:

    There are two ways you could gain access to the detailed view of a listing: by clicking the link on the "Business Name" field or by clicking the "View" button.
    Changing the behavior for the link can be done by modifying function get_field_html_value() inside form-fields.php (around line 71) and changing

    $value = sprintf( '<a href="%s">%s</a>', get_permalink( $post_id ), get_the_title( $post_id ) );

    to

    $value = sprintf( '<a href="%s" target="_blank">%s</a>', get_permalink( $post_id ), get_the_title( $post_id ) );

    Notice the target="_blank" addition.

    As for the "View" button refer to the file templates/parts/listing-buttons.tpl.php around line 15. Change

    onclick="window.location.href = '<?php the_permalink(); ?>' "

    to

    onclick="window.open('<?php the_permalink(); ?>', '_blank');"

    That should do the trick.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic