0

関数を記述してショートコードを追加しましたが、そのショートコードをworpdressページエディターの中央で使用しようとすると、自動的にページの先頭に移動し、適切な場所で機能しません。これがfunction.phpの私のコードです

function get_review() {  ?>
    <div style="clear:both;"></div>
    <div id="banner-fade">
        <ul class="bjqs">
            <?php query_posts('cat=5&showposts=5&order=DESC'); if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                <li>
                    <div class="Call-to-action">
                        <div class="inside clearfix">
                            <h4>What our clients say...</h4>
                            <h5 style="width: 645px; text-align: justify;">
                                <?php   the_content(); ?>
                            </h5>
                            <a href="http://www.360creditconsulting.com/products-page/" class="call_to_action  call_to_action_contact">
                                <span>Get Started Now</span>
                            </a>
                        </div>
                    </div>
                </li>
            <?php endwhile; endif; wp_reset_query(); ?>
        </ul>
    </div> 
    <?php 
}
add_shortcode('get_review', 'get_review');

そして私は次のようなページを使用しています:いくつかのコンテンツ... [get_review]

その後、彼らはショートコードのそのo/pのように自動的に表示されましたいくつかのコンテンツ...

これが私がチェックしているURLです http://www.360creditconsulting.com/test-page/

どんな助けでもありがたいです。私は完全に立ち往生しています。

前もって感謝します。

4

1 に答える 1

0

スクリプトの最後でこれらの行を使用します。

$output_string = ob_get_contents();
ob_end_clean();
return $output_string;
于 2016-09-14T05:50:12.513 に答える