类别中的 WordPress 帖子不会显示
WordPress Posts from category won't display
我使用了一个名为 "Custom Content Type Manage" 的插件
这允许我创建一个新的内容类型,它基本上模仿 posts(全部以 'user friendly' 的名义完成)
除此之外,我写了以下内容:
<h2><?php single_cat_title( '', true ); ?></h2>
<p>
<?php
$page_id = '5536';
$page_data = get_page($page_id);
print apply_filters('the_content', $page_data->post_content);
?>
</p>
<p>
<?php
$category = get_the_category();
$category_id = $category[0]->cat_ID;
print category_description( $category_id );
?>
</p>
<div class="category-list">
<?php wp_nav_menu(); ?>
</div>
<ul class="leaders-container">
<?php if (have_posts()) : while (have_posts()) : the_post();?>
<li class="leader-container">
<?php
$image = get_custom_field('leader_image:to_image_array');
$url = get_custom_field('website_url:raw');
print "<img class='leader-image' src='".$image['0']."'>";
?>
<h2>
<?php the_title(); ?>
</h2>
<?php
print "</h2>";
the_content();
if($url != "#") {
print "<a class='website-button' href='".$url."' target='_blank'>Visit Website</a>";
}
?>
</li>
<?php endwhile; endif;?>
这是做什么的,是从类别中获取信息,并列出分配给该类别的所有 post。
在这种情况下,post 被标记为 "Leader",类别是他们的 "congregation",因此它列出了分配给会众的所有领袖。
这是它应该是什么样子的一个例子
http://www.ubmsonline.org/?leader=rabbi-binyamin-sheldrake
然而,这仅适用于它是来自 post 的直接 link
另一方面,该类别一直有效,并且确实列出了分配给该类别的许多领导者,但现在已停止工作。
http://www.ubmsonline.org/category/ubms-leaders/
如您所见,它正确地显示了所有内容,包括类别描述、类别标题等,但它现在没有显示 posts。
已修复!
这与我使用的 "Custom Content Type Manager" 插件上的设置更改有关。经过大量研究,我在插件常见问题解答页面的 "issues" 部分偶然发现了确切的问题。
https://code.google.com/p/wordpress-custom-content-type-manager/issues/detail?id=594
希望这对其他人有帮助。
在 wp-content/plugins/custom-content-type-manager/loader.php 中,下面提到的过滤器可能会被注释,因此如果您取消注释此 add_filter,此错误将得到修复。
// Enable archives for custom post types
add_filter('request', 'CCTM::request_filter');
再次感谢大家的帮助。
安德鲁
我使用了一个名为 "Custom Content Type Manage" 的插件 这允许我创建一个新的内容类型,它基本上模仿 posts(全部以 'user friendly' 的名义完成) 除此之外,我写了以下内容:
<h2><?php single_cat_title( '', true ); ?></h2>
<p>
<?php
$page_id = '5536';
$page_data = get_page($page_id);
print apply_filters('the_content', $page_data->post_content);
?>
</p>
<p>
<?php
$category = get_the_category();
$category_id = $category[0]->cat_ID;
print category_description( $category_id );
?>
</p>
<div class="category-list">
<?php wp_nav_menu(); ?>
</div>
<ul class="leaders-container">
<?php if (have_posts()) : while (have_posts()) : the_post();?>
<li class="leader-container">
<?php
$image = get_custom_field('leader_image:to_image_array');
$url = get_custom_field('website_url:raw');
print "<img class='leader-image' src='".$image['0']."'>";
?>
<h2>
<?php the_title(); ?>
</h2>
<?php
print "</h2>";
the_content();
if($url != "#") {
print "<a class='website-button' href='".$url."' target='_blank'>Visit Website</a>";
}
?>
</li>
<?php endwhile; endif;?>
这是做什么的,是从类别中获取信息,并列出分配给该类别的所有 post。
在这种情况下,post 被标记为 "Leader",类别是他们的 "congregation",因此它列出了分配给会众的所有领袖。
这是它应该是什么样子的一个例子 http://www.ubmsonline.org/?leader=rabbi-binyamin-sheldrake
然而,这仅适用于它是来自 post 的直接 link
另一方面,该类别一直有效,并且确实列出了分配给该类别的许多领导者,但现在已停止工作。 http://www.ubmsonline.org/category/ubms-leaders/
如您所见,它正确地显示了所有内容,包括类别描述、类别标题等,但它现在没有显示 posts。
已修复!
这与我使用的 "Custom Content Type Manager" 插件上的设置更改有关。经过大量研究,我在插件常见问题解答页面的 "issues" 部分偶然发现了确切的问题。
https://code.google.com/p/wordpress-custom-content-type-manager/issues/detail?id=594
希望这对其他人有帮助。
在 wp-content/plugins/custom-content-type-manager/loader.php 中,下面提到的过滤器可能会被注释,因此如果您取消注释此 add_filter,此错误将得到修复。
// Enable archives for custom post types
add_filter('request', 'CCTM::request_filter');
再次感谢大家的帮助。
安德鲁