在wordpress中自定义修改Related Post插件

时间:2014-06-12 08:28:05

标签: php wordpress pagination wordpress-plugin

我支持在Wordpress 3.8上运行的网站,其中包含wpzoom主题(zenko),其中大部分文章都在多个页面上运行。 对于分页导航,我们使用带有该功能的WP-PageNavi插件http://wordpress.org/extend/plugins/wp-pagenavi/ <?php wp_pagenavi( array( 'type' => 'multipart' ) ); ?> 插入后的single.php代码中 <?php the_content(); ?>功能。 最近我们添加了WordPress相关帖子http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/。但是,当激活时,相关的帖子会出现在页面导航链接按钮之前,我宁愿将其更改为显示在它们之后。 在相关的帖子插件代码中查看,我找到了相应的格式代码如下:

global $wp_rp_output;
$wp_rp_output = array();
function wp_rp_add_related_posts_hook($content) {
global $wp_rp_output, $post;

$options = wp_rp_get_options();

if ($content != "" && $post->post_type === 'post' && (($options["on_single_post"] && is_single()) || (is_feed() && $options["on_rss"]))) {
    if (!isset($wp_rp_output[$post->ID])) {
        $wp_rp_output[$post->ID] = wp_rp_get_related_posts();
    }
    $content = str_replace('%RELATEDPOSTS%', '', $content); // used for gp
    $content = $content . $wp_rp_output[$post->ID];
}

return $content;
}
add_filter('the_content', 'wp_rp_add_related_posts_hook', 10);

我的问题是如何修改代码,以便在页面导航链接

之后显示相关帖子的数组

0 个答案:

没有答案