我們發現了一個WordPress插件,可以很好地進行一些修改。一切工作都在一個頁面上,但我們希望將插件簡碼移動到主頁上。當我們這樣做時,會顯示簡碼,而不是插件輸出。我讀過插件可以執行的時間限制(即不在側邊欄中),還有一些代碼可以讓短代碼起作用,但無論如何,我們都會在索引上看到簡碼,而不是插件輸出。在主頁/ index上運行Wordpress插件短代碼
有沒有人有任何獲得插件簡碼在wordpress安裝的主頁/索引頁上工作的經驗?
感謝,
更新:下面是我相信生成網頁的index.php文件。我們對這個文件進行了修改來更新主頁,這是我將短代碼放入標準HTML(這可能不是正確的方法)。
<?php get_header();?>
<div id="content">
<h1 class="hidden">Haute Inhabit</h1>
<div class="wrapper clear">
<div class="main section" id="main" role="main">
<div class="widget Blog" id="Blog1">
<div class="blog-posts hfeed">
<!-- google_ad_section_start(name=default) -->
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$query = new WP_Query(array('paged' => $paged, 'cat'=>'-460'));
//$query = new WP_Query('cat=-460&posts_per_page=5');
if ($query->have_posts()):
/*$tmp = $wp_query;
$wp_query = null;
$wp_query = new WP_Query('showposts=3');*/
//$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
//$my_query = new WP_Query('showposts=3&paged=' . $paged);
while ($query->have_posts()) : $query->the_post(); ?>
<div class="post hentry">
<a id="6576135133677080233" name=
"6576135133677080233"></a>
<h3 class="date-header"><span><?php echo get_the_date(); ?></span></h3>
<h2 class="post-title entry-title"><a href="<?php the_permalink();?>"><?php the_title();?></a></h2>
<div class="post-lead entry-content">
<?php echo get_first_paragraph() ?>
</div>
<div class="post-image">
<a href="<?php the_permalink();?>">
<?php
if (has_post_thumbnail()) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail('full');
} else {
?>
<img src="<?php echo catch_that_image() ?>">
<?php } ?>
</a>
</div>
<div class="post-utility">
<div class="inner clear">
<a href="<?php the_permalink();?>" class="view">View More</a>
<div class="comments">
<?php if (comments_open()) : ?><span class="comments-link"><?php comments_popup_link('<span class="leave-reply">' . __('Comment', 'hautein') . '</span>', __('<em>1</em> Comment', 'hautein'), __('<em>%</em> Comments', 'hautein')); ?></span>
<?php endif; // End if comments_open() ?>
</div>
<a href="#" class="share"><span>Share</span></a>
</div>
<?php include('inc/social.php'); ?>
</div>
</div>
<?php endwhile;?>
<?php
// $wp_query=$tmp;
//hautein_content_nav('nav-below');
endif;?>
<div class="pagination clear">
<?php
global $wp_query;
$big = 999999999; // need an unlikely integer
echo paginate_links(array(
'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
'format' => '?paged=%#%',
'current' => max(1, get_query_var('paged')),
'total' => $wp_query->max_num_pages,
'prev_text' => 'Prev',
'next_text' => 'Next'
));
?>
</div>
</div>
<script type="text/javascript">
window.___gcfg = {'lang': 'en'};
</script>
</div>
</div>
<?php get_sidebar();?>
</div>
</div>
<?php get_footer();?>
這是否只能在側邊欄中使用? – dagey 2014-11-04 03:38:09
不,它應該在任何小工具區域中工作 – jk3455 2014-11-04 06:36:01