I’ve previously detailed the code for enabling rich snippets in various wordpress themes (أحجية 2, أحجية 3, أطروحة & أحب) وكذلك بعض generic instructions. Below is a set of edits to enable rich snippets in the built-in wordpress twenty eleven theme.
1. تحرير functions.php, خط 584, edit the first line of the function twentyeleven_posted_on()
والتغيير
<time class="entry-date" datetime="%3$ق">
إلى
<time class="entry-date updated" datetime="%3$ق">
2. تحرير المحتوى page.php, خط 14
<h1 class="دخول عنوان"><?php the_title(); ?></h1> </رأس><!-- .entry-header -->
أضف ما يلي 2 خطوط
<h1 class="دخول عنوان"><?php the_title(); ?></h1> <تمتد الطبقة ="تحديث"><تمتد الطبقة ="القيمة اللقب" عنوان ="<?فب the_date(); ?>"></شبر></شبر> By <تمتد الطبقة ="author vcard"><تمتد الطبقة ="FN"><?php the_author_posts_link(); ?></شبر></شبر> </رأس><!-- .entry-header -->
3. Make sure your author information page has a link to your google+ profile
تحرير functions.php, at the bottom add
function yoast_add_google_profile( $contactmethods ) { // Add Google Profiles $contactmethods['google_profile'] = 'Google Profile <abbr title="محدد موقع المعلومات">URL</ابر>'; return $contactmethods; } add_filter( 'user_contactmethods', 'yoast_add_google_profile', 10, 1);
then go to your wordpress profile page (dashboard: المستخدمين: your profile) and fill in the google profile URL الجزء
4. Edit author.php to link to google profile, خط تحرير 28 (بين >header>
و </header>
) واستبدال
<h1 class="page-title author"><?php printf( __( 'Author Archives: %s', 'twentyeleven' ), '<تمتد الطبقة ="vcard"><a class="url fn n" = HREF"' . esc_url( get_author_posts_url( get_the_author_meta( "ID" ) ) ) . '" عنوان ="' . esc_attr( get_the_author() ) . '" rel="me">' . get_the_author() . '</ا></شبر>' ); ?></h1>
مع
<h1 class="page-title author"><?php printf( __( 'Author Archives: %s', 'twentyeleven' ), '<تمتد الطبقة ="vcard"><a class="url fn n" = HREF"' . esc_url( get_the_author_meta( "google_profile" ) ) . '" عنوان ="' . esc_attr( get_the_author() ) . '" rel="me">' . get_the_author() . '</ا></شبر>' ); ?></h1>
وجدت هذا مفيدا? يرجى إعلامنا عن طريق إسقاط التعليق أدناه. إذا كنت ترغب في الاشتراك يرجى استخدام الرابط الاشتراك في القائمة في اعلى اليمين. يمكنك أيضا مشاركة هذا مع أصدقائك باستخدام الروابط الاجتماعية أدناه. في صحتك.
شكرا جزيلا.
Is this solution for twentytwelve ?
Im working on a static website and i really didnt want to show updated by admin on my webpages. 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?
يرجع الفضل في ذلك مسبقا، ونأمل أن نسمع منك
Awesome, problem solved… Thanks for brilliant tutorial.
من دواعي سروري, thanks for your comment 🙂
مرحبا, شكرا لرمز لكنه لم يشفي 20-11.
There is an incongruity in the first code substitution – the lines are identical
1. تحرير functions.php, خط 581 تعديل السطر الأول من وظيفة twentyeleven_posted_on()
تغيير
1
إلى
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…
تحديث: I’ve totally rejigged how code is implemented and displayed. Hopefully this will prevent any future recurrence, and along the way I think the functionality and presentation has been improved too. اسمحوا لي أن أعرف ما هو رأيك. 🙂
نعم فعلا – 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 (بحق IMHO) is that if you think a search engine should see that information, then it’s useful information, and therefore your visitors should see it too! You can easily apply CSS to style it and reposition it if you wish.