簡體   English   中英

將php do_shortcode添加到WordPress中的數組

[英]Adding php do_shortcode to array in WordPress

我在這里有此代碼:

$defaults = array(
 'id' => 'private_message-'.$user_id,
 'component' => 'messages',
 'must_be_logged_in' => true,
 'block_self' => true,
 'wrapper_id' => 'send-private-message-'.$user_id,
 'wrapper_class' =>'send-private-message',
 'link_href' => hibuddy_get_send_private_message_url(),
 'link_title' => __( 'Ask the model a question about this item!', 'buddypress' ),
 'link_text' => __( 'Send Seller a Private Message', 'buddypress' ),
 'link_class' => 'send-message',
 );

我正在嘗試更改表示以下內容的行:

 'link_text' => __( 'Send Seller a Private Message', 'buddypress' ),

...至:

'link_text' => __( 'echo do_shortcode('[button]'.Send Seller a Private Message.'[/button]')', 'buddypress' ),

...但是它不喜歡它。 簡而言之,我試圖將“向賣家發送私人消息”文本更改為輸出[button]向賣家發送私人消息[/ button],這需要WordPress的do_shortcode。

謝謝!

您可以嘗試一下,但是除非'link_text'允許HTML而不是純文本,否則它可能無法工作:

'link_text' => __( do_shortcode('[button]Send Seller a Private Message[/button]'), 'buddypress' ),

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM