创建 "view all posts" link 以显示 wordpress 中特定类别的所有帖子
Creating "view all posts" link to show all posts from a specific category in wordpress
我是 wordpress 新手。在一个页面中,我显示了来自特定类别的 3 个最新的 post。所以现在,我想放一个 "view all posts" link 以便访问者可以看到该类别中的所有 post。但是我做不到。
请帮助创建这个 link。
我应该在此 (href="---") 属性中放入什么代码? -->
<a href="">view all posts</a>
请描述清楚。
https://codex.wordpress.org/Function_Reference/get_category_link
手抄本示例:
<?php
// Get the ID of a given category
$category_id = get_cat_ID( 'Category Name' );
// Get the URL of this category
$category_link = get_category_link( $category_id );
?>
<!-- Print a link to this category -->
<a href="<?php echo esc_url( $category_link ); ?>" title="Category Name">Category Name</a>
有效,
<a href="<?php echo get_permalink( get_option( 'page_for_posts' ) );?>"><p> Blog </p> </a>
创建一个名为博客的页面
然后从设置 > 阅读设置帖子页面 > 博客
我是 wordpress 新手。在一个页面中,我显示了来自特定类别的 3 个最新的 post。所以现在,我想放一个 "view all posts" link 以便访问者可以看到该类别中的所有 post。但是我做不到。
请帮助创建这个 link。
我应该在此 (href="---") 属性中放入什么代码? -->
<a href="">view all posts</a>
请描述清楚。
https://codex.wordpress.org/Function_Reference/get_category_link
手抄本示例:
<?php
// Get the ID of a given category
$category_id = get_cat_ID( 'Category Name' );
// Get the URL of this category
$category_link = get_category_link( $category_id );
?>
<!-- Print a link to this category -->
<a href="<?php echo esc_url( $category_link ); ?>" title="Category Name">Category Name</a>
有效,
<a href="<?php echo get_permalink( get_option( 'page_for_posts' ) );?>"><p> Blog </p> </a>
创建一个名为博客的页面 然后从设置 > 阅读设置帖子页面 > 博客