2021年12月的文章
隐藏WordPress顶部黑条去除管理员登录工具条
将下边的代码选择其一方法放入到你主题的 functions.php 文件内即可 方法一 show_admin_bar(false); 方法二 add_filter('show_admin_bar', '__return_false'); 方法三 只对特定用户显示工具条...
WordPress调用指定分类下的文章
调用WordPress指定分类的文章代码如下: <ul> <?php query_posts('cat=15&posts_per_page=10'); while(have_posts()): the_post(); ?> <li><a href='&l...
WordPress获取最早或最近文章函数:get_boundary_post
WordPress函数get_boundary_post用于获取最早或最近发表的一篇文章,在实际应用中使用得非常少。 get_boundary_post( boolean $in_same_term = false, string $excluded_terms = '', boolean $s...
WordPress获取相邻文章函数:get_adjacent_post
WordPress函数get_adjacent_post用于获取相邻文章的信息,包括文章ID、文章发表时间、文章标题、文章别名、文章内容和文章摘要等。 get_adjacent_post( boolean $in_same_term = false, array $...
wp移除(wp_head)函数-头部不必要的元素标签
以下内容都在主题的functions.php文件写入 1.移除WordPress版本信息 remove_action( 'wp_head', 'wp_generator' ); 2.移除离线编辑器开放接口 remove_action( 'wp_head', 'rsd_link' ); remove_...