如何在WordPress 网站文章未尾自动添加一个作者信息框?如果想在WordPress文章的末尾,添加文章作者的相关信息,下面一段代码可以方便在文章中添加一个作者的信息框。...= get_the_author_meta( 'user_description', $post->post_author ); // 获取作者的网站 $user_website...= get_the_author_meta('url', $post->post_author); // 作者存档页面链接 $user_posts = get_author_posts_url...( get_the_author_meta( 'ID' , $post->post_author)); if ( !.... get_avatar( get_the_author_meta('user_email') , 90 ) . nl2br( $user_description ).
php if ( get_the_author_meta( 'description' ) ): ?...php if (get_the_author_meta('qzone')){ ?>author_meta('qzone'); ?...php if (get_the_author_meta('weibo')){ ?>author_meta('weibo'); ?...php if (get_the_author_meta('douban')){ ?>author_meta('douban'); ?...php if (get_the_author_meta('sohu')){ ?>author_meta('sohu'); ?
display name $display_name = get_the_author_meta( 'display_name', $post->post_author ); // If display...= get_the_author_meta( 'user_description', $post->post_author ); // Get author's website URL $user_website...= get_the_author_meta('url', $post->post_author); // Get link to the author archive page $user_posts...= get_author_posts_url( get_the_author_meta( 'ID' , $post->post_author)); if ( !.... get_avatar( get_the_author_meta('user_email') , 90 ) . nl2br( $user_description ).
Wordpress 中文文档 1、文章中->作者 显示文章的作者 : author(); ?> 显示该文章的作者名称,该函数必须放在Loop中(文章的主循环中)。...如果用在php中而不让作者名称显示出来可以使用get_the_author(),使用方法和下面是一样的。 显示文章作者的描述(作者个人资料中的描述): get_the_author_meta( $field, $author_id);?> 1 get_the_author_meta( $field, $author_id);?...> 示例: Shell global $post; $author_id=$post->post_author; //获取用户昵称 $nickname = get_the_author_meta(...'nickname', $author_id); 1234 global $post;$author_id=$post->post_author;//获取用户昵称$nickname = get_the_author_meta
,如需在hook中调用的必须在after_theme_setup中调用; add_theme_support( 'post-thumbnails' ,[array( 'post' )]); 启用指定类型文章的缩略图功能...URL保存在post_meta表 12.wp_options表 option可直接存放一个数组;当我们单独访问许多选项数据时,可能导致许多单独的数据库事务,通常,数据库事务是昂贵的操作(就时间和服务器资源而言...如果你的主题或者插件有一个选项页,合理的 控制对该页的访问时非常重要的。...== false) { } 3.获取访问的目录和标签对象 <?...php get_the_author_meta( 'display_name', $post->post_author )
如何在wordpress 文章页和单页面隐藏作者/发布者呢,下面魏艾斯博客来详细说一下操作步骤。...进入 wordpress 后台,点击外观-编辑,在右侧找到并点击 single.php,进入编辑页面,每个人使用的模板不同,只要找到包含“author”的代码就对了,要包括前后的 css 样式。...php echo get_author_posts_url( get_the_author_meta( ‘ID’ ) ) ?>”>author() ?...同样的方法在单页面 page.php 里面找到 author 这段代码删除后保存,这样在前台的单页面也隐藏了作者名字了。
ver=xxx后,你会发现,访问时数据库的查询次数变少了。 WP前台顶部清理 function cwp_header_clean_up(){ if (!...',$clean);} remove_action( 'wp_head', 'feed_links_extra', 3 ); remove_action( 'wp_head'..., 'feed_links', 2 ); remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 ); remove_action...( 'wp_head', 'start_post_rel_link', 10, 0 ); remove_action( 'wp_head', 'adjacent_posts_rel_link...foreach(array('single_post_title','bloginfo','wp_title','category_description','list_cats','comment_author
在外观 -> 主题编辑器 中,找到 index.php 找到 这行代码 在循环内添加代码 author-link" rel="author" href="author_posts_url( get_the_author_meta( 'ID' ), get_the_author_meta( 'user_nicename...>"> author-name"><?php if(function_exists('the_views')) { the_views(); } ?
force_display’ – (布尔型)是否始终显示头像,忽略wordpress后台里设置——评论里设置的【头像显示】设置,默认为false ‘extra_attr’ – (字符串)插入img元素,如alt...php echo get_avatar(get_the_author_meta('email'), 50); ?> 获取指定ID用户头像 <?php echo get_avatar(1, 50); ?...php $getavatar = get_avatar(get_the_author_meta('email'),50,'','全百科网',array('width'=>56,'height'=>56
博客刚建立也没去花心思修改,今天空下来了,就去 DIY 了下,变成了我们习惯的读法: 由**发表于 20**年**月**日 (如本文副标题:由 Mars 丶 Ge 发表于 2013 年 12 月 23...替换成下面的代码后保存即可: function twentyten_posted_on() { printf( __( '由 %2$s 发表于 %3$s', 'twentyten' ), 'meta-prep...meta-prep-author', sprintf( '%3$s', get_author_posts_url( get_the_author_meta... esc_attr( sprintf( __( 'View all posts by %s', 'twentyten' ), get_the_author...() ) ), get_the_author() ), sprintf( '%3$s',
php echo get_avatar( get_the_author_meta( 'ID' ), apply_filters( 'Readd_status_avatar', '48' ) ); ?...--post--> 注:别的主题使用的时候请修改一下类似上面代码中 <?php the_content( __( '','Readd' ) ); ?...> 这一行中的‘Readd’,此为自己主题的名字。此处包括全文(上面不止一处),凡是涉及到这个的一律都要修改为自己的主题名字。...php echo get_avatar( get_the_author_meta( 'ID' ), apply_filters( 'Readd_status_avatar', '48' ) ); ?...在修改的过程中,我们难免会用到时间函数,这当然就涉及到了WordPress 的时间格式。
所以,在作者页面中,我们要使用 the_author_meta 这个函数来获取后台填写的信息。 the_author_meta 函数的用法很简单,只需要下面的参数传递进去,就会返回对应的信息。...比较常用的有: nickname user_url display_name description 如果想要调用个人资料中的描述,就可以使用这样的语句 the_author_meta('description...如果你想对获取的个人资料进行“二次加工”之后再显示,那么需要使用 get_the_author_meta 函数。...Google Talk'), 'fetion' => '飞信' ); return $user_contactmethods ; } 在前台调用只需要使用类似 the_author_meta...最后使用 CSS 修饰 将调用函数等,插入到对应的 HTML 结构中,然后使用 CSS 修饰一下外观。这样,就算是为博客增加了作者介绍页面。本文并没有使用一个真实的案例,而只是给出相关功能实现方法。
('l10n'); remove_action('wp_head','rsd_link');//移除head中的rel="EditURI" remove_action('wp_head','wlwmanifest_link...');//移除head中的rel="wlwmanifest" remove_action('wp_head','rsd_link');//rsd_link移除XML-RPC remove_filter...、第一篇文章、主页meta信息 WordPress把前后文、第一篇文章和主页链接全放在meta中。...但是如果你觉得这个标签对你无用,也可以移除之: remove_action( 'wp_head', 'rel_canonical' ); 八、移除feed HTML 中通过来指定博客feed。...如果你不想添加feed,或者想使用烧制的feed(如FeedSky或者Feedburner烧制的feed),可以移除之。
wordpress有很多的函数可供调用,下面ytkah就整理了一下wordpress函数大全供各位参考,如果要详情,可以访问https://developer.wordpress.org/reference...remove_meta_box get_the_ID the_ID get_the_author the_author get_the_author_posts get_the_content the_content...get_the_modified_author is_multi_author 用户 meta add_user_meta delete_user_meta get_user_meta update_user_meta...get_the_author_meta 用户添加和删除 wp_create_user wp_delete_user wp_insert_user wp_update_user 登录和注销 is_user_logged_in...wp_get_cookie_login(不赞成) wp_get_image_editor wp_get_installed_translations wp_hash wp_handle_sideload wp_head
版本号 WordPress 会在页面头部显示你的 WordPress 版本号: meta name="generator" content="WordPress 3.5.1" /> 作为博主的你,当然知道自己所使用的...RSD)是XML格式的一种发布约定,用于使 WordPress 可以被客户端软件发现,这是一种将客户端软件所需的信息减少到三个众所周知的元素的方法:用户名,密码和主页URL,其他关键设置都在 RSD 文件中定义...p=13150 这个的短链接的方式快速访问。它会在文章详情页的页面头部输出代码如下: 这个代码是用来告诉 APP 开发者,当前站点的 REST API 的地址,这个口头告诉一下就行了,没有必要在代码中输出...: remove_action('wp_head', 'wp_generator'); remove_action('wp_head', 'rsd_link'); remove_action('wp_head
我们在介绍一些 Javasctipt 类库或者特效的时候,为了能够更加清楚的展示 Javascript 的效果,需要在日志中做演示,这个时候我们需要加载 Javascript 脚本或者 CSS 样式表,...比如这篇日志:Pluralink:一个链接多个选择,中为了演示 Pluralink 的一个链接显示多个链接效果,就需要在日志中加入 Pluralink 的 Javascript 代码和 CSS 样式表。...那么你首先需要把下面这段代码复制到你主题的 functions.php 文件中,也可以直接当作一个插件,上传到插件目录中,然后在后台激活。 <?...Version: 0.1 Author: Denis Author URI: http://wpjam.com/ */ add_action("wp_head","custom_head"); function...custom_head(){ if (is_single() || is_page()) { global $post; $custom_head = get_post_meta
', 'feed_links_extra', 3 ); remove_action( 'wp_head', 'rsd_link' ); remove_action( 'wp_head', 'wlwmanifest_link...' ); remove_action( 'wp_head', 'index_rel_link' ); remove_action( 'wp_head', 'start_post_rel_link',...; #移除 "活动" unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_activity']); #移除 "WordPress...切换经典文章编辑器(v5.x开始默认古腾堡编辑器) add_filter('use_block_editor_for_post', '__return_false'); //替换评论用户头像链接为国内镜像加速访问...], $new_img, $content); } } return $content; } //判断是否是移动设备浏览 if(wp_is_mobile()) { #删除文章内容中img
新建一个shuoshuo.php文件放到你正在使用的主题根目录里,把下面代码放入shuoshuo.php中: Code Source <?...php /* Template Name: 说说 author: 小王子 url: https://www.wanghao.me */ get_header(); ?...> author_img">get_the_author_meta( 'user_email' ) ,48 ); ?...更多精彩可以访问导航中的微语了解!!! 本文最后更新于2021年4月5日,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!
在我们之前创建的主题目录wp-content\themes\Yii-Candy下新建一个文件header.php,我们提取出index.php中的头部代码复制粘贴到header.php中即可,下面的是目前...接下来,我们将仔细探讨header.php中的内容。...>" /> 添加wp_head 有些插件需要在网页头部执行一些类如添加一些js或css的动作,要让这些插件能够正常的工作,也让你的主题有更好的兼容性,你应该添加wp_head()函数。...php wp_head(); ?> 添加Description 和 Keywords 在之前添加以下代码: " /> 显示菜单栏 这里只在菜单栏中列出页面page,将header.php中以下代码: <a href="contact.html
所以便需要我们手动为WordPress添加后台可自定义上传头像的功能,如下:将下面的代码加入到你主题的Functions.php 文件中即可//自定义头像class Simple_Local_Avatars...$avatar; $size = (int) $size; if ( empty( $alt ) ) $alt = get_the_author_meta...= is_author( $user_id ) ?...' current-author' : '' ; $avatar = "author_class} photo' height='{$size}' width=
领取专属 10元无门槛券
手把手带您无忧上云