admin管理员组文章数量:1393092
I develops elementor widget.my a href code doesnt work like i want.the plugin works like that: admin set a url as text in elementor widget tab.and the text display as link for all equipment div:
<div class="col-xs-12">
<div class="bag">
<?php $settings = $this->get_settings_for_display();
$html = wp_oembed_get($settings['url']);
echo '<a href="';
echo $settings['url'];
echo '">';
?>
<div class="dot dot1">
Ekipman
</div>
</a>
you can look at the working link:
/homepage/
bottom of the link page there are box.you should click a box.then click right picture which is equipment (dot1) div.
when you click the equipment div, it opens:
/homepage/sgdghd
however i want only sgdghd
I develops elementor widget.my a href code doesnt work like i want.the plugin works like that: admin set a url as text in elementor widget tab.and the text display as link for all equipment div:
<div class="col-xs-12">
<div class="bag">
<?php $settings = $this->get_settings_for_display();
$html = wp_oembed_get($settings['url']);
echo '<a href="';
echo $settings['url'];
echo '">';
?>
<div class="dot dot1">
Ekipman
</div>
</a>
you can look at the working link:
http://www.migrate2.deniz-tasarim.site/homepage/
bottom of the link page there are box.you should click a box.then click right picture which is equipment (dot1) div.
when you click the equipment div, it opens:
http://www.migrate2.deniz-tasarim.site/homepage/sgdghd
however i want only sgdghd
Share Improve this question asked Feb 11, 2020 at 18:50 ahmet kayaahmet kaya 331 silver badge9 bronze badges 3- And what does that $settings[‘url’] contain? – Krzysiek Dróżdż Commented Feb 11, 2020 at 19:21
- 1 It sounds like you have only entered "sgdghd" as the URL, and that's not a valid link. Try entering "sgdghd" and see if that works without prepending. – WebElaine Commented Feb 11, 2020 at 20:31
- Smoke detector doesn't like this post – user161710 Commented Feb 12, 2020 at 0:08
1 Answer
Reset to default 0sgdghd
is not a complete URL on its own, and if used in a link like <a href="sgdghd">
, it will be treated as a relative URL. To properly link to a different domain, you need to include http://
or https://
.
To ensure that a value for href
is a valid URL, you should use esc_url()
when outputting it. That way if a user enters an incomplete URL in the settings, it will still be output correctly:
echo '<a href="';
echo esc_url( $settings['url'] );
echo '">';
本文标签: phplta hrefURLgt opens like sitenamecomURL
版权声明:本文标题:php - <a href=URL> opens like sitename.comURL 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744757107a2623529.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论