Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Here are some Schema we want to make sure we integrate based on some SEO experts advice:
- //Publishing Principles
- //Add this code to your Child Theme to tie all of your siteβs content to a specific such of Publishing Guidelines. Enter your //URL, but keep the [β β] intact.
- //Reveal Code
- //custom schema
- //publishing principles
- add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
- if ( isset( $data['publisher'] ) ) {
- $data['publisher']['publishingPrinciples'] = ['https://stg-ptpioneer-ptpstandard.kinsta.cloud/editorial-integrity/'];
- }
- return $data;
- }, 99, 2 );
- //Add Reviewed By data
- //Add this code to enable a [reviewed_by] shortcode, letting you dynamically display who (if anyone) reviewed the article //anywhere.
- //Reveal Code
- function reviewed_by_helper() {
- $author_id = get_field('reviewed_by');
- $user_info = get_userdata($author_id);
- $user_name = $user_info->display_name;
- $user_url = get_author_posts_url($author_id);
- return '<a href="' . $user_url . '">' . $user_name . '</a>';
- }
- add_shortcode('reviewed_by', 'reviewed_by_helper');
- add_filter('rank_math/snippet/rich_snippet_product_entity', function ($entity) {
- $score = get_post_meta(get_the_ID(), 'users_rating', true); // Replace with your rating post meta.
- $count = get_post_meta(get_the_ID(), 'users_rating_count', true); // Replace with your rating count post meta.
- $entity['aggregateRating'] = array(
- '@type' => 'aggregateRating',
- 'ratingValue' => $score,
- 'ratingCount' => $count,
- );
- return $entity;
- });
- //Custom Article Schema
- //This custom schema will feed all of the various custom Author and Expert fields youβve set up so that Google can easily see //them.
- //Add this custom JSON text into RankMath (This requires the Pro version to work) to link up all the data to each individual //article.
- //Reveal Code
- {
- "@context": "https://schema.org",
- "@graph": {
- "@type": "Article",
- "articleSection": "%primary_taxonomy_terms%",
- "headline": "%seo_title%",
- "description": "%seo_description%",
- "keywords": "%keywords%",
- "author": {
- "@type": "Person",
- "name": "%name%",
- "description": "%user_description%",
- "jobTitle": "%author_job%",
- "alumniOf": {
- "@type": "EducationalOrganization",
- "name": "%author_alumni%",
- "sameAs": "%author_alumni_url%"
- },
- "knowsAbout": "%author_knowsabout%"
- },
- "datePublished": "%date(Y-m-dTH:i:sP)%",
- "dateModified": "%modified(Y-m-dTH:i:sP)%",
- "image": {
- "@type": "ImageObject",
- "url": "%post_thumbnail%"
- },
- "reviewedBy": {
- "@type": "Person",
- "name": "%reviewer_name%",
- "url": "%reviewer_url%",
- "sameAs": "%reviewer_sameAs%",
- "description": "%reviewer_description%",
- "jobTitle": "%reviewer_job%",
- "alumniOf": {
- "@type": "EducationalOrganization",
- "name": "%reviewer_alumni%",
- "sameAs": "%reviewer_alumni_url%"
- },
- "knowsAbout": "%reviewer_knowsabout%"
- }
- }
- }
- //Acf Import file
- [
- {
- "key": "group_64a6871dc3795",
- "title": "Author fields",
- "fields": [
- {
- "key": "field_64a6871ef9004",
- "label": "Knows about 1",
- "name": "author_knowabout",
- "aria-label": "",
- "type": "text",
- "instructions": "",
- "required": 0,
- "conditional_logic": 0,
- "wrapper": {
- "width": "",
- "class": "",
- "id": ""
- },
- "default_value": "",
- "maxlength": "",
- "placeholder": "",
- "prepend": "",
- "append": ""
- },
- {
- "key": "field_64a7bffdf93a8",
- "label": "Knows about 2",
- "name": "author_knowabout_2",
- "aria-label": "",
- "type": "text",
- "instructions": "",
- "required": 0,
- "conditional_logic": 0,
- "wrapper": {
- "width": "",
- "class": "",
- "id": ""
- },
- "default_value": "",
- "maxlength": "",
- "placeholder": "",
- "prepend": "",
- "append": ""
- },
- {
- "key": "field_64a7c00cf93a9",
- "label": "Knows about 3",
- "name": "author_knowabout_3",
- "aria-label": "",
- "type": "text",
- "instructions": "",
- "required": 0,
- "conditional_logic": 0,
- "wrapper": {
- "width": "",
- "class": "",
- "id": ""
- },
- "default_value": "",
- "maxlength": "",
- "placeholder": "",
- "prepend": "",
- "append": ""
- },
- {
- "key": "field_64a7c012f93aa",
- "label": "Knows about 4",
- "name": "author_knowabout_4",
- "aria-label": "",
- "type": "text",
- "instructions": "",
- "required": 0,
- "conditional_logic": 0,
- "wrapper": {
- "width": "",
- "class": "",
- "id": ""
- },
- "default_value": "",
- "maxlength": "",
- "placeholder": "",
- "prepend": "",
- "append": ""
- },
- {
- "key": "field_64a7c014f93ab",
- "label": "Knows about 5",
- "name": "author_knowabout_5",
- "aria-label": "",
- "type": "text",
- "instructions": "",
- "required": 0,
- "conditional_logic": 0,
- "wrapper": {
- "width": "",
- "class": "",
- "id": ""
- },
- "default_value": "",
- "maxlength": "",
- "placeholder": "",
- "prepend": "",
- "append": ""
- },
- {
- "key": "field_64a68771f9008",
- "label": "Job Title",
- "name": "author_jobtitle",
- "aria-label": "",
- "type": "text",
- "instructions": "",
- "required": 0,
- "conditional_logic": 0,
- "wrapper": {
- "width": "",
- "class": "",
- "id": ""
- },
- "default_value": "",
- "maxlength": "",
- "placeholder": "",
- "prepend": "",
- "append": ""
- },
- {
- "key": "field_64a6bd8bcfb01",
- "label": "Alumni of",
- "name": "author_alumniof",
- "aria-label": "",
- "type": "text",
- "instructions": "",
- "required": 0,
- "conditional_logic": 0,
- "wrapper": {
- "width": "",
- "class": "",
- "id": ""
- },
- "default_value": "",
- "maxlength": "",
- "placeholder": "",
- "prepend": "",
- "append": ""
- },
- {
- "key": "field_64a7c091f93ac",
- "label": "Alumni of URL",
- "name": "author_alumniof_url",
- "aria-label": "",
- "type": "url",
- "instructions": "",
- "required": 0,
- "conditional_logic": 0,
- "wrapper": {
- "width": "",
- "class": "",
- "id": ""
- },
- "default_value": "",
- "placeholder": ""
- },
- {
- "key": "field_64a7c0a4f93ad",
- "label": "Author long description",
- "name": "author_description",
- "aria-label": "",
- "type": "wysiwyg",
- "instructions": "",
- "required": 0,
- "conditional_logic": 0,
- "wrapper": {
- "width": "",
- "class": "",
- "id": ""
- },
- "default_value": "",
- "tabs": "all",
- "toolbar": "full",
- "media_upload": 1,
- "delay": 0
- },
- {
- "key": "field_64ae7271f4014",
- "label": "Facebook profile",
- "name": "facebook_profile",
- "aria-label": "",
- "type": "url",
- "instructions": "",
- "required": 0,
- "conditional_logic": 0,
- "wrapper": {
- "width": "",
- "class": "",
- "id": ""
- },
- "default_value": "",
- "placeholder": ""
- },
- {
- "key": "field_64ae7284f4015",
- "label": "LinkedIn Profile",
- "name": "linkedin_profile",
- "aria-label": "",
- "type": "url",
- "instructions": "",
- "required": 0,
- "conditional_logic": 0,
- "wrapper": {
- "width": "",
- "class": "",
- "id": ""
- },
- "default_value": "",
- "placeholder": ""
- },
- {
- "key": "field_64ae7293f4016",
- "label": "Instagram profile",
- "name": "instagram_profile",
- "aria-label": "",
- "type": "url",
- "instructions": "",
- "required": 0,
- "conditional_logic": 0,
- "wrapper": {
- "width": "",
- "class": "",
- "id": ""
- },
- "default_value": "",
- "placeholder": ""
- },
- {
- "key": "field_64ae72a5f4017",
- "label": "Twitter Profile",
- "name": "twitter_profile",
- "aria-label": "",
- "type": "url",
- "instructions": "",
- "required": 0,
- "conditional_logic": 0,
- "wrapper": {
- "width": "",
- "class": "",
- "id": ""
- },
- "default_value": "",
- "placeholder": ""
- },
- {
- "key": "field_64ae72b4f4018",
- "label": "Youtube Profile",
- "name": "youtube_profile",
- "aria-label": "",
- "type": "url",
- "instructions": "",
- "required": 0,
- "conditional_logic": 0,
- "wrapper": {
- "width": "",
- "class": "",
- "id": ""
- },
- "default_value": "",
- "placeholder": ""
- },
- {
- "key": "field_64aea8f7e08c9",
- "label": "Website Profile",
- "name": "website_profile",
- "aria-label": "",
- "type": "url",
- "instructions": "",
- "required": 0,
- "conditional_logic": 0,
- "wrapper": {
- "width": "",
- "class": "",
- "id": ""
- },
- "default_value": "",
- "placeholder": ""
- },
- {
- "key": "field_64aea907e08ca",
- "label": "Email profile",
- "name": "email_profile",
- "aria-label": "",
- "type": "text",
- "instructions": "",
- "required": 0,
- "conditional_logic": 0,
- "wrapper": {
- "width": "",
- "class": "",
- "id": ""
- },
- "default_value": "",
- "maxlength": "",
- "placeholder": "",
- "prepend": "",
- "append": ""
- }
- ],
- "location": [
- [
- {
- "param": "user_role",
- "operator": "==",
- "value": "all"
- }
- ]
- ],
- "menu_order": 0,
- "position": "normal",
- "style": "default",
- "label_placement": "top",
- "instruction_placement": "label",
- "hide_on_screen": "",
- "active": true,
- "description": "",
- "show_in_rest": 0
- },
- {
- "key": "group_64a3ef3013119",
- "title": "Reviewed by",
- "fields": [
- {
- "key": "field_64a3ef30b7aa7",
- "label": "Reviewed by",
- "name": "reviewed_by",
- "aria-label": "",
- "type": "user",
- "instructions": "",
- "required": 0,
- "conditional_logic": 0,
- "wrapper": {
- "width": "",
- "class": "",
- "id": ""
- },
- "role": [
- "contributor",
- "author",
- "editor",
- "administrator"
- ],
- "return_format": "id",
- "multiple": 0,
- "allow_null": 0
- }
- ],
- "location": [
- [
- {
- "param": "post_type",
- "operator": "==",
- "value": "page"
- }
- ],
- [
- {
- "param": "post_type",
- "operator": "==",
- "value": "post"
- }
- ]
- ],
- "menu_order": 0,
- "position": "normal",
- "style": "default",
- "label_placement": "top",
- "instruction_placement": "label",
- "hide_on_screen": "",
- "active": true,
- "description": "",
- "show_in_rest": 0
- }
- ]
Advertisement
Add Comment
Please, Sign In to add comment