【问题标题】:Convert PHP $text into clickable url link on frontend在前端将 PHP $text 转换为可点击的 url 链接
【发布时间】:2017-04-09 16:46:28
【问题描述】:

我在 WordPress 中的 functions.php 文件中添加了一个脚本,以在 Woocommerce 感谢页面中生成其他文本。

 **
* Custom text on the receipt page.
*/
function isa_order_received_text( $text, $order ) {
$new = $text . ' A receipt has been sent to you via email.Please submit your ticket here:https://google.com';
return $new;
}

部分文本是指向另一个页面的链接。

Please submit your ticket here:https://google.com';

但是,该链接不会在前端显示为突出显示/可点击的 URL。我该如何解决这个问题?

【问题讨论】:

  • <a href=""> ... ?
  • 使用基本 HTML? <a href="...">...</a>?
  • 哎呀!真是个傻瓜!有时我会惊讶自己!谢谢。

标签: php wordpress woocommerce


【解决方案1】:

在你的 PHP 字符串中使用一个链接: $new = $text . ' A receipt has been sent to you via email.Please submit your ticket <a href="https://google.com">here</a>';

【讨论】:

    【解决方案2】:

    试试这个

     **
    * Custom text on the receipt page.
    */
    function isa_order_received_text( $text, $order ) {
    $new = $text . ' A receipt has been sent to you via email.Please submit your ticket <a href="https://google.com">here</a>';
    return $new;
    }
    

    【讨论】:

      【解决方案3】:
      $new = $text . ' A receipt has been sent to you via email.Please submit your ticket <a href="https://google.com">here (https://google.com)</a>';
      return $new;
      

      【讨论】:

      • -1是什么原因?
      猜你喜欢
      • 2022-11-24
      • 2014-02-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-13
      • 1970-01-01
      • 2018-04-08
      相关资源
      最近更新 更多