WordPress常用函数
-
get_cat_name()函数
get_cat_name()函数的主要功能是通过id值来获得分类的名称。 语法 <? php get_cat_name( int $cat_id ); ?> 参数 (i…
-
wp_list_bookmarks()函数
wp_list_bookmarks()函数是比较常用的WordPress函数,特别是在我们想要调用友情链接时,就肯定用的到了。 语法 <? php wp_list_bookm…
-
get_post_custom_values()函数
get_post_custom_values()函数是获取当前日志中所有自定义字段值,如果该值不存在或为空都将返回null,也称作自定义域函数。类似于get_post_meta()…
-
wp_get_theme()函数
wp_get_theme()函数主要作用是用来获得WordPress主题的相关信息。语法 <?php wp_get_theme($stylesheet, $theme_roo…
-
get_theme_file_path()函数
get_theme_file_path()函数可以用来引入主题中某个文件,也就是说你想找到主题中某个文件,可以用此函数来查找。语法 get_theme_file_path( str…
-
get_post_thumbnail_id()函数
get_post_thumbnail_id()函数主要是用来获取文章缩略图ID,通过该函数,如果当前文章设置了特色图像,就可以返回该特色图像的ID,如果没有设置则返回null值。 …
-
get_post_format()函数
get_post_format()函数用于获取文章的形式,在为不同形式的文章制作不同的模板时非常有用。 语法 get_post_format( int $post = null )…
-
site_url()函数
用法 <?php site_url( $path, $scheme ); ?> 默认用法 <?php echo site_url(); ?> 实例 $ ur…
-
home_url()函数
用法 <?php home_url( $path, $scheme ); ?> 默认用法 <?php echo esc_url( home_url( ‘/’ ) …
-
register_setting()函数
register_setting()函数 <?php register_setting( string $option_group, string $option_name,…
-
add_settings_field( )函数
add_settings_field( )函数的作用主要是为WordPress后台-Settings添加一些新的自定义变量(此处可能用词不当,仿照织梦自定义变量为此处命名)用法 &…
-
wp_deregister_script()函数
wp_deregister_script()函数主要是用来去除WordPress本身自带的一些js文件,一把情况下,我们制作的WordPress主题的前端会加载一些比如jquery…
-
get_comment_meta()函数
get_comment_meta()函数主要是用来把新增加的评论的字段的值在后台展示出来。 语法 <?php get_comment_meta( $comment_id, $…
-
update_comment_meta()函数
update_comment_meta()更新一个评论的meta自定义附加信息,主要是给wp_commentmeta表增加新的字段。 语法 <?php update_comm…
-
get_comments_number()函数
某些时候我们需要在网站上面展示出文章的评论数量,这时候就需要使用get_comments_number()函数,这个函数能够完美的实现这个需求。 语法
-
post_password_required()函数
post_password_required()函数用来判断文章是否需要输入密码或者输入的密码是否正确 语法 <?php post_password_required(); …