我已经编写了一个函数并添加了短代码,但是当我尝试在 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');
我使用的页面如下: 一些内容... [获取评论]
之后他们会自动显示为这样 简码的 o/p 一些内容...
这是我正在检查的网址 http://www.360creditconsulting.com/test-page/
任何帮助将不胜感激。我完全被困住了。
提前致谢。
在脚本末尾使用这些行。
$output_string = ob_get_contents();
ob_end_clean();
return $output_string;
Manish Srivastava 的答案对我来说非常有效。