0
ショートコード機能でdo_shortcode
を使用しようとしています。問題は、自分のページに[terms_and_conditions]
を使用すると、do_shortcode
が解析されず、[MM_Form_Field type='custom' id='1' isRequired='true' class='']
と表示されるということです。それは実行されていません。 ob_start
が大幅にあなたのショートコードをクリーンアップすることができます使用do_shortcode内でショートコードを解析していません
function terms_and_conditions($atts) {
// Variables
$terms = get_field('terms_content', 'options');
$checkbox = get_field('terms_checkbox_msg', 'options');
// $smarttag = get_field('terms_smarttag', 'options');
$smarttag = do_shortcode(get_field('terms_smarttag', 'options'));
var_dump($smarttag);
$html_out = '';
$html_out .= '<section id="terms">';
$html_out .= '<div class="terms-content-wrapper">';
$html_out .= $terms;
$html_out .= '</div>'; // end terms-content-wrapper
$html_out .= '<div class="terms-checkbox-wrapper">';
$html_out .= '<div class="terms-checkbox">';
$html_out .= do_shortcode($smarttag);
$html_out .= '<p>' . $checkbox . '</p>';
$html_out .= '</div>'; // end terms-checkbox
$html_out .= '</div>'; // end terms-content-wrapper
$html_out .= '</section>'; // end tip-wrapper
return $html_out;
}
add_shortcode('terms_and_conditions', 'terms_and_conditions');
get_field( 'terms_smarttag'、 'options') 'は正確に何を返しますか?また、いくつかの奇妙なショートコードマジックをやっているのですか、do_shortcodeの戻り値にdo_shortcodeを間違って実行していますか? – janh
@janh誰かが、このインスタンスでは 'do_shortcode'を二度実行する必要があると私に言った。私はそれも間違っていると思っていたし、私はそれを '$ html_out。= $ smarttag;'としていた。 'get_field'は[MM_Form_Field type = 'カスタム' id = '1' isRequired = 'true' class = '']を返します。 –
'get_field( 'terms_smarttag'、 'options')'の内容は何ですか?私はdo-shortcodeを2回実行する必要はないと思います。 '[shortcode_a] [shortcode_b] [/ shortcode_a]' – admcfajn