我前面介绍的代码在不同的WordPress主题实现丰富网页摘要 (奥秘 2, 奥秘 3, 论文 & 我喜欢) 以及一些 通用说明. 下面是一组编辑的,以使富含内置的wordpress 20 11主题片段.
1. 编辑的functions.php, 线 584, 编辑功能的第一行 twentyeleven_posted_on()
和变化
<时间类="入门日期" 日期时间="%3$s">
to
<时间类="入门更新日期" 日期时间="%3$s">
2. 编辑内容page.php, 线 14
<H1类="入门称号"><?PHP the_title(); ?></H1> </头><!-- .入门头 - >
添加如下 2 线
<H1类="入门称号"><?PHP the_title(); ?></H1> <跨度类="更新"><跨度类="值标题" 标题="<?PHP the_date(); ?>"></跨度></跨度> 通过 <跨度类="作者电子名片"><跨度类="FN"><?PHP the_author_posts_link(); ?></跨度></跨度> </头><!-- .入门头 - >
3. 确保您的作者信息页面有链接到你的谷歌+简介
编辑的functions.php, 在底部添加
功能yoast_add_google_profile( $contactmethods ) { // 加入谷歌简介 $ contactmethods[“google_profile”] ='谷歌个人资料 <缩写标题="统一资源定位器">网址</缩写>“; 返回$ contactmethods; } 的add_filter( “user_contactmethods”, “yoast_add_google_profile”, 10, 1);
然后去到你的WordPress的个人资料页 (仪表板: 用户: 你的个人资料) 并填写谷歌个人资料 网址 部分
4. 编辑author.php链接到Google个人资料, 编辑行 28 (之间 >header>
and </header>
) 和替换
<H1类="页面标题作者"><?PHP的printf( __( “作者档案: %S', “twentyeleven” ), “<跨度类="电子名片"><一类="网址FNÑ" HREF ="“ . esc_url( get_author_posts_url( get_the_author_meta( "ID" ) ) ) . “" 标题="“ . esc_attr( get_the_author() ) . “" 相对="我">“ . get_the_author() . “</一></跨度>“ ); ?></H1>
同
<H1类="页面标题作者"><?PHP的printf( __( “作者档案: %S', “twentyeleven” ), “<跨度类="电子名片"><一类="网址FNÑ" HREF ="“ . esc_url( get_the_author_meta( "google_profile" ) ) . “" 标题="“ . esc_attr( get_the_author() ) . “" 相对="我">“ . get_the_author() . “</一></跨度>“ ); ?></H1>
你怎么看? 请给我们一个评论如下! 如果您想订阅,请使用菜单上的订阅链接右上方. 您还可以通过使用下面的链接社会分享这与你的朋友. 干杯.
多谢.
Is this solution for twentytwelve ?
进出口工作在一个静态的网站,我真的没有想展示者:我的网页更新. is there any way i can hide that but remove snippets error too…
i know u said its not recommended method but do u know how can i do that…. ????
谢谢
我敢打赌,你的丰碑, 谢谢
你好,
你认为该解决方案也是twentytwelve?
在此先感谢,并希望听到您的意见
真棒, problem solved… Thanks for brilliant tutorial.
荣幸, 感谢您的评论🙂
你好, 感谢您的代码,但它并不能治愈20-11.
There is an incongruity in the first code substitution – the lines are identical
1. 编辑的functions.php, 线 581 编辑功能twentyeleven_posted_on的第一行()
变化
1
to
1
I am still getting the “更新” field error and now it prints the author name at the top of pages and the update date on the top of posts.
抱歉 – when I updated the post a while back I didn’t notice that the wordpress visual editor had removed all the class=”” 码! It should now be fixed…
更新资料: 我已经完全rejigged如何实现代码,并显示. 希望这将阻止任何未来再次发生, 一路上我认为功能和显示已经过改进. 让我知道你在想什么. 🙂
是的 – it will show the author name and the updated date on posts – this is required. Google will penalise your ranking if you try to implement snippets which tag up hidden content – their view (正当地 恕我直言) 是,如果你认为搜索引擎应该看到的信息, 那么它的有用信息, 因此,您的访问者应该看到它太! 您可以轻松地应用 CSS 的风格,并重新定位它,如果你想.