Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Add 'blank target' to link WordPress

  • SOLVED

Looking for someone to take the following and add the equivalent of html 'target=blank' to open a new window.

<!-- Ad 1 link url: Text Input -->
<p>
<label for="<?php echo $this->get_field_id( 'link1' ); ?>"><?php _e('Ad 1 link url:', 'mediapress') ?></label>
<input class="widefat" id="<?php echo $this->get_field_id( 'link1' ); ?>" name="<?php echo $this->get_field_name( 'link1' ); ?>" value="<?php echo $instance['link1']; ?>" />
</p>

Answers (2)

2011-03-28

Denzel Chia answers:

Hi,

The target _blank should be added at the output of the widget, which can be found in function widget of the widget class, and not at the form input.

There should be a line of code in function widget that echos the $instance into a link.

Just send me an email telling me the details and I will add it for you.

Thanks.
Denzel


Denzel Chia comments:

Hi,

I won't charge you an hour for this, I will accept this price money.

Looking forward to your reply.

Thanks.
Denzel

2011-03-28

Lew Ayotte answers:

That doesn't really make any sense... You can't add target="_blank" to a input field (which I assume is of type='text'

What are you ultimately trying to accomplish?


Patrick MacAdams comments:

I have an Ad widget with a URL input field. The above code is the Ad's URL input field. I'd like to have the Ad's link open in a new window.


Lew Ayotte comments:

You'll need to edit the Widget code or if it's coded properly, you'll need to add an hook to your functions.php file... the plugin might also have a setting somewhere to tell it to open ads in a new window.

What plugin are you using?