So I have a custom field displaying a link:
<li><a href="<?php echo get_post_meta($post->ID, 'link_banner', true); ?>" target="<?php echo get_post_meta($post->ID, 'target_banner', true); ?>"><?php the_post_thumbnail(); ?></a></li>
The link banner stands for:
function link_banner(){
global $post;
$custom = get_post_custom($post->ID);
$link_banner = $custom["link_banner"][0];
?>
<label>Link do banner:</label><br/>
<input name="link_banner" type="text" value="<?php echo $link_banner; ?>" />
<?php
}
What I need is:
If the client wants the page to display a link INSIDE the WordPress website, the target will be _self. If the client wants the page to display OUTSITE the wordpress, the target will be _blank.
I created another function called target_banner
function target_banner(){
global $post;
$custom = get_post_custom($post->ID);
$link_banner = $custom["link_banner"][0];
?>
<label>Target do banner:</label><br/>
<select>
<option name="_blank" value="_blank">Nova Janela</option>
<option name="_self" value="_self">Mesma Janela</option>
</select>
<?php
}
The problem is: it doesn't works. What´s the solution? :(
The idea is:
- 1) Inside Link -> SELF
- 2) Outside Link -> BLANK
- If the client clicks: Same Window (Mesma Janela), the target will be self.
- if the client clicks: New Window (Nova Janela), target will be blank.
The client HAS to be the option to display same window or new window.
I tried, I searched all StackOverflow and Google and I didn't find.
Thanks anyway. :)
The website is this one: Ítalo Bianchi.
This big code is used at the slide.
So in the back-end I have three fields.
"Legenda" is for the title (it will not be used for now); "Link" is for the well... link; And the "target" if the link will open in a new window or in the same window.
So all internal links will be open in the same window and all external links will be open at a new window. Sorry. My original post was a little confusing.
<select>needs thenameattribute... Debug your post viavar_dump($_POST).. also, your<option>'s don't neednameattributes. - Rob W