• 进行文章数量统计的wordpress函数wp_count_posts()

    近日很多朋友咨询进行文章数量统计的wordpress函数wp_count_posts()是什么?今天小编为大家简单分享一下。wp_count_posts()是用于统计指定文章类型文章数量的wordpress函数,通过wp_count_posts()函数可以统计所有类型的文章数量,如post、page或自定义文章类型post_type等,还可以计算指定状态的文章,如已发布、定时发布、草稿、待审、私有等。 代码结构: <?phpwp_count_posts(‘type’…

    WordPress模板 2022年8月31日
  • WordPress主题函数get_the_category_by_ID()知识点

    WordPress主题函数get_the_category_by_ID()知识点。 描述: 通过分类id获取分类所有信息 用法: <?php get_the_category_by_ID( $cat_ID ); ?> 参数: $cat_ID (int) (必填) 分类ID 默认值:None 源文件: /** * Retrieve category name based on category ID. * * @since 0.71 * * @param int $cat_ID Cat…

    WordPress模板 2022年8月31日
  • WordPress主题函数get_category_by_slug()知识点

    WordPress主题函数get_category_by_slug()知识点。 描述: 通过分类别名获取分类所有信息 用法: <?php get_category_by_slug( $slug ); ?> 参数: $slug (string) (必填) 分类别名 默认值:None 示例: <?php $idObj = get_category_by_slug(‘category-slug’); $id = $idObj->term_id;?>…

    WordPress模板 2022年8月31日
  • 常用WordPress函数bloginfo()与get_bloginfo()

    bloginfo() 函数用来返回用户博客的相关信息,可将返回的信息用在PHP代码中,大部分都是显示WordPress管理界面的用户资料和常规设置中的信息。该WordPress函数与get_bloginfo()均可以显示博客相关信息。它可以在模板文件的任何地方使用。一般 bloginfo() 都是用来直接在浏览器中输出内容的。如果你需要在PHP中返回值的话,那就用 get_bloginfo()。 函数用法:<?php bloginfo( $show ); ?> 其中$show是参数,…

    WordPress模板 2022年8月31日
  • 链接重定向跳转WordPress函数wp_redirect()

    链接重定向跳转WordPress函数wp_redirect()简单地理解就是通过该函数可以实现页面跳转到指定URL地址,并可设置指定的状态码,如301、302等。 函数代码 wp_redirect( string $location, int $status = 302, string $x_redirect_by = ‘WordPress’ ) 参数说明: $location – 字符串,必选,要重定向到的URL,需要是绝对URL地址,不能是相对地址,默认值为空(该值为…

    WordPress模板 2022年8月31日
  • 获取文章类型注册的分类法名称WordPress函数get_object_taxonomies

    创建了自定义文章类型以及注册文章类型的分类法,如果需要在前台页面获取自定义文章类型所属的taxonomy分类法,可以使用自定义文章类型的名称,通过get_object_taxonomies()函数返回注册的分类法的名称或对象。今天就来讲讲获取文章类型注册的分类法名称WordPress函数get_object_taxonomies。 代码结构 get_object_taxonomies( string|string[]|WP_Post $object, string $output = &#821…

    WordPress模板 2022年8月31日
  • 插入视频短代码WordPress函数wp_video_shortcode

    如何给WordPress网站插入视频呢?我们一起看看插入视频短代码WordPress函数wp_video_shortcode。 wp_video_shortcode( array $attr, string $content = ” ) wp_video_shortcode的官方描述,用来构建短代码输出视频。这实现了视频短代码在帖子中显示mp4的功能。 参数说明 $attr (array) (必须) 短代码属性值 ‘src’ (string) 视频资源的URL地址,默认空 ‘heig…

    WordPress模板 2022年8月31日
  • 修改缩略图大小WordPress函数add_image_size

    在做WordPress主题的时候,要设置上传图片缩略图大小,我们看看修改缩略图大小WordPress函数add_image_size,此函数的得当设置,可以很好的配合你主题内容区域的图片展示,省去你在写文章时不停的调整图片大小的麻烦。 函数介绍 add_image_size( $name, $width, $height, $crop ); $name,要设置的缩略图名称,可接受 ‘large’,’medium’等 $width, 设定的最大宽度 $height, 设定的最大高度 $crop,是…

    WordPress模板 2022年8月31日
  • 获取侧边栏WordPress函数get_sidebar用法

    获取侧边栏WordPress函数get_sidebar用法: get_sidebar函数位于wp-includes/general-template.php第100行左右,函数原型如下: function get_sidebar( $name = null ) { /** * Fires before the sidebar template file is loaded. * * The hook allows a specific sidebar template file to be us…

    WordPress模板 2022年8月31日
  • 获取页脚WordPress函数get_footer用法

    获取页脚WordPress函数get_footer用法,该函数位于wp-include/general-template.php 文件的第 61 行左右的位置,代码如下。 function get_footer( $name = null ) { /** * Fires before the footer template file is loaded. * * The hook allows a specific footer template file to be used in place…

    WordPress模板 2022年8月31日
  • 如何解决WordPress内置函数mb_strimwidth()不能用问题?

    通常WordPress内置函数mb_strimwidth()可截取WordPress的文章里首段文字了,但是会有些服务器或主机尽然不支持 php-mbstring ,那么如何解决WordPress内置函数mb_strimwidth()不能用问题?<?php echo mb_strimwidth(strip_tags($post->post_content),0,100,’…’);?> 如果是自己的服务器,可以尝试用 yum install p…

    WordPress模板 2022年8月31日
  • WordPress功能函数add_allowed_options()

    WordPress功能函数add_allowed_options(),向允许的选项列表中添加选项数组。 add_allowed_options( array $new_options, string|array $options = ” ) 参数: $new_options (array) (必需) $options (string|array) (可选) 默认值: ” 返回: (数组) 来源: 文件: wp-admin/includes/plugin.php funct…

    WordPress模板 2022年8月31日
房先生
我们将24小时内回复。
2024-07-12 17:46:38
您好,有任何疑问请与我们联系!
您的工单我们已经收到,我们将会尽快跟您联系!
[QQ客服]
2781198
加我微信
[电话联系]
13585372227
[电子邮件]
chaoneo@163.com
取消

选择聊天工具: