pradeepkumar10

Rankmath file

Oct 26th, 2023 (edited)
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.68 KB | None | 0 0
  1. //Here are some Schema we want to make sure we integrate based on some SEO experts advice:
  2. //Publishing Principles
  3. //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.
  4.  
  5.  
  6.  
  7. //Reveal Code
  8. //custom schema
  9. //publishing principles
  10. add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
  11. if ( isset( $data['publisher'] ) ) {
  12. $data['publisher']['publishingPrinciples'] = ['https://stg-ptpioneer-ptpstandard.kinsta.cloud/editorial-integrity/'];
  13. }
  14. return $data;
  15. }, 99, 2 );
  16.  
  17. //Add Reviewed By data
  18. //Add this code to enable a [reviewed_by] shortcode, letting you dynamically display who (if anyone) reviewed the article //anywhere.
  19. //Reveal Code
  20. function reviewed_by_helper() {
  21. $author_id = get_field('reviewed_by');
  22. $user_info = get_userdata($author_id);
  23. $user_name = $user_info->display_name;
  24. $user_url = get_author_posts_url($author_id);
  25. return '<a href="' . $user_url . '">' . $user_name . '</a>';
  26. }
  27. add_shortcode('reviewed_by', 'reviewed_by_helper');
  28.  
  29.  
  30. add_filter('rank_math/snippet/rich_snippet_product_entity', function ($entity) {
  31. $score = get_post_meta(get_the_ID(), 'users_rating', true); // Replace with your rating post meta.
  32. $count = get_post_meta(get_the_ID(), 'users_rating_count', true); // Replace with your rating count post meta.
  33. $entity['aggregateRating'] = array(
  34. '@type' => 'aggregateRating',
  35. 'ratingValue' => $score,
  36. 'ratingCount' => $count,
  37. );
  38. return $entity;
  39. });
  40.  
  41. //Custom Article Schema
  42. //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.
  43. //Add this custom JSON text into RankMath (This requires the Pro version to work) to link up all the data to each individual //article.
  44. //Reveal Code
  45. {
  46. "@context": "https://schema.org",
  47. "@graph": {
  48. "@type": "Article",
  49. "articleSection": "%primary_taxonomy_terms%",
  50. "headline": "%seo_title%",
  51. "description": "%seo_description%",
  52. "keywords": "%keywords%",
  53. "author": {
  54. "@type": "Person",
  55. "name": "%name%",
  56. "description": "%user_description%",
  57. "jobTitle": "%author_job%",
  58. "alumniOf": {
  59. "@type": "EducationalOrganization",
  60. "name": "%author_alumni%",
  61. "sameAs": "%author_alumni_url%"
  62. },
  63. "knowsAbout": "%author_knowsabout%"
  64. },
  65. "datePublished": "%date(Y-m-dTH:i:sP)%",
  66. "dateModified": "%modified(Y-m-dTH:i:sP)%",
  67. "image": {
  68. "@type": "ImageObject",
  69. "url": "%post_thumbnail%"
  70. },
  71. "reviewedBy": {
  72. "@type": "Person",
  73. "name": "%reviewer_name%",
  74. "url": "%reviewer_url%",
  75. "sameAs": "%reviewer_sameAs%",
  76. "description": "%reviewer_description%",
  77. "jobTitle": "%reviewer_job%",
  78. "alumniOf": {
  79. "@type": "EducationalOrganization",
  80. "name": "%reviewer_alumni%",
  81. "sameAs": "%reviewer_alumni_url%"
  82. },
  83. "knowsAbout": "%reviewer_knowsabout%"
  84. }
  85. }
  86. }
  87.  
  88. //Acf Import file
  89. [
  90. {
  91. "key": "group_64a6871dc3795",
  92. "title": "Author fields",
  93. "fields": [
  94. {
  95. "key": "field_64a6871ef9004",
  96. "label": "Knows about 1",
  97. "name": "author_knowabout",
  98. "aria-label": "",
  99. "type": "text",
  100. "instructions": "",
  101. "required": 0,
  102. "conditional_logic": 0,
  103. "wrapper": {
  104. "width": "",
  105. "class": "",
  106. "id": ""
  107. },
  108. "default_value": "",
  109. "maxlength": "",
  110. "placeholder": "",
  111. "prepend": "",
  112. "append": ""
  113. },
  114. {
  115. "key": "field_64a7bffdf93a8",
  116. "label": "Knows about 2",
  117. "name": "author_knowabout_2",
  118. "aria-label": "",
  119. "type": "text",
  120. "instructions": "",
  121. "required": 0,
  122. "conditional_logic": 0,
  123. "wrapper": {
  124. "width": "",
  125. "class": "",
  126. "id": ""
  127. },
  128. "default_value": "",
  129. "maxlength": "",
  130. "placeholder": "",
  131. "prepend": "",
  132. "append": ""
  133. },
  134. {
  135. "key": "field_64a7c00cf93a9",
  136. "label": "Knows about 3",
  137. "name": "author_knowabout_3",
  138. "aria-label": "",
  139. "type": "text",
  140. "instructions": "",
  141. "required": 0,
  142. "conditional_logic": 0,
  143. "wrapper": {
  144. "width": "",
  145. "class": "",
  146. "id": ""
  147. },
  148. "default_value": "",
  149. "maxlength": "",
  150. "placeholder": "",
  151. "prepend": "",
  152. "append": ""
  153. },
  154. {
  155. "key": "field_64a7c012f93aa",
  156. "label": "Knows about 4",
  157. "name": "author_knowabout_4",
  158. "aria-label": "",
  159. "type": "text",
  160. "instructions": "",
  161. "required": 0,
  162. "conditional_logic": 0,
  163. "wrapper": {
  164. "width": "",
  165. "class": "",
  166. "id": ""
  167. },
  168. "default_value": "",
  169. "maxlength": "",
  170. "placeholder": "",
  171. "prepend": "",
  172. "append": ""
  173. },
  174. {
  175. "key": "field_64a7c014f93ab",
  176. "label": "Knows about 5",
  177. "name": "author_knowabout_5",
  178. "aria-label": "",
  179. "type": "text",
  180. "instructions": "",
  181. "required": 0,
  182. "conditional_logic": 0,
  183. "wrapper": {
  184. "width": "",
  185. "class": "",
  186. "id": ""
  187. },
  188. "default_value": "",
  189. "maxlength": "",
  190. "placeholder": "",
  191. "prepend": "",
  192. "append": ""
  193. },
  194. {
  195. "key": "field_64a68771f9008",
  196. "label": "Job Title",
  197. "name": "author_jobtitle",
  198. "aria-label": "",
  199. "type": "text",
  200. "instructions": "",
  201. "required": 0,
  202. "conditional_logic": 0,
  203. "wrapper": {
  204. "width": "",
  205. "class": "",
  206. "id": ""
  207. },
  208. "default_value": "",
  209. "maxlength": "",
  210. "placeholder": "",
  211. "prepend": "",
  212. "append": ""
  213. },
  214. {
  215. "key": "field_64a6bd8bcfb01",
  216. "label": "Alumni of",
  217. "name": "author_alumniof",
  218. "aria-label": "",
  219. "type": "text",
  220. "instructions": "",
  221. "required": 0,
  222. "conditional_logic": 0,
  223. "wrapper": {
  224. "width": "",
  225. "class": "",
  226. "id": ""
  227. },
  228. "default_value": "",
  229. "maxlength": "",
  230. "placeholder": "",
  231. "prepend": "",
  232. "append": ""
  233. },
  234. {
  235. "key": "field_64a7c091f93ac",
  236. "label": "Alumni of URL",
  237. "name": "author_alumniof_url",
  238. "aria-label": "",
  239. "type": "url",
  240. "instructions": "",
  241. "required": 0,
  242. "conditional_logic": 0,
  243. "wrapper": {
  244. "width": "",
  245. "class": "",
  246. "id": ""
  247. },
  248. "default_value": "",
  249. "placeholder": ""
  250. },
  251. {
  252. "key": "field_64a7c0a4f93ad",
  253. "label": "Author long description",
  254. "name": "author_description",
  255. "aria-label": "",
  256. "type": "wysiwyg",
  257. "instructions": "",
  258. "required": 0,
  259. "conditional_logic": 0,
  260. "wrapper": {
  261. "width": "",
  262. "class": "",
  263. "id": ""
  264. },
  265. "default_value": "",
  266. "tabs": "all",
  267. "toolbar": "full",
  268. "media_upload": 1,
  269. "delay": 0
  270. },
  271. {
  272. "key": "field_64ae7271f4014",
  273. "label": "Facebook profile",
  274. "name": "facebook_profile",
  275. "aria-label": "",
  276. "type": "url",
  277. "instructions": "",
  278. "required": 0,
  279. "conditional_logic": 0,
  280. "wrapper": {
  281. "width": "",
  282. "class": "",
  283. "id": ""
  284. },
  285. "default_value": "",
  286. "placeholder": ""
  287. },
  288. {
  289. "key": "field_64ae7284f4015",
  290. "label": "LinkedIn Profile",
  291. "name": "linkedin_profile",
  292. "aria-label": "",
  293. "type": "url",
  294. "instructions": "",
  295. "required": 0,
  296. "conditional_logic": 0,
  297. "wrapper": {
  298. "width": "",
  299. "class": "",
  300. "id": ""
  301. },
  302. "default_value": "",
  303. "placeholder": ""
  304. },
  305. {
  306. "key": "field_64ae7293f4016",
  307. "label": "Instagram profile",
  308. "name": "instagram_profile",
  309. "aria-label": "",
  310. "type": "url",
  311. "instructions": "",
  312. "required": 0,
  313. "conditional_logic": 0,
  314. "wrapper": {
  315. "width": "",
  316. "class": "",
  317. "id": ""
  318. },
  319. "default_value": "",
  320. "placeholder": ""
  321. },
  322. {
  323. "key": "field_64ae72a5f4017",
  324. "label": "Twitter Profile",
  325. "name": "twitter_profile",
  326. "aria-label": "",
  327. "type": "url",
  328. "instructions": "",
  329. "required": 0,
  330. "conditional_logic": 0,
  331. "wrapper": {
  332. "width": "",
  333. "class": "",
  334. "id": ""
  335. },
  336. "default_value": "",
  337. "placeholder": ""
  338. },
  339. {
  340. "key": "field_64ae72b4f4018",
  341. "label": "Youtube Profile",
  342. "name": "youtube_profile",
  343. "aria-label": "",
  344. "type": "url",
  345. "instructions": "",
  346. "required": 0,
  347. "conditional_logic": 0,
  348. "wrapper": {
  349. "width": "",
  350. "class": "",
  351. "id": ""
  352. },
  353. "default_value": "",
  354. "placeholder": ""
  355. },
  356. {
  357. "key": "field_64aea8f7e08c9",
  358. "label": "Website Profile",
  359. "name": "website_profile",
  360. "aria-label": "",
  361. "type": "url",
  362. "instructions": "",
  363. "required": 0,
  364. "conditional_logic": 0,
  365. "wrapper": {
  366. "width": "",
  367. "class": "",
  368. "id": ""
  369. },
  370. "default_value": "",
  371. "placeholder": ""
  372. },
  373. {
  374. "key": "field_64aea907e08ca",
  375. "label": "Email profile",
  376. "name": "email_profile",
  377. "aria-label": "",
  378. "type": "text",
  379. "instructions": "",
  380. "required": 0,
  381. "conditional_logic": 0,
  382. "wrapper": {
  383. "width": "",
  384. "class": "",
  385. "id": ""
  386. },
  387. "default_value": "",
  388. "maxlength": "",
  389. "placeholder": "",
  390. "prepend": "",
  391. "append": ""
  392. }
  393. ],
  394. "location": [
  395. [
  396. {
  397. "param": "user_role",
  398. "operator": "==",
  399. "value": "all"
  400. }
  401. ]
  402. ],
  403. "menu_order": 0,
  404. "position": "normal",
  405. "style": "default",
  406. "label_placement": "top",
  407. "instruction_placement": "label",
  408. "hide_on_screen": "",
  409. "active": true,
  410. "description": "",
  411. "show_in_rest": 0
  412. },
  413. {
  414. "key": "group_64a3ef3013119",
  415. "title": "Reviewed by",
  416. "fields": [
  417. {
  418. "key": "field_64a3ef30b7aa7",
  419. "label": "Reviewed by",
  420. "name": "reviewed_by",
  421. "aria-label": "",
  422. "type": "user",
  423. "instructions": "",
  424. "required": 0,
  425. "conditional_logic": 0,
  426. "wrapper": {
  427. "width": "",
  428. "class": "",
  429. "id": ""
  430. },
  431. "role": [
  432. "contributor",
  433. "author",
  434. "editor",
  435. "administrator"
  436. ],
  437. "return_format": "id",
  438. "multiple": 0,
  439. "allow_null": 0
  440. }
  441. ],
  442. "location": [
  443. [
  444. {
  445. "param": "post_type",
  446. "operator": "==",
  447. "value": "page"
  448. }
  449. ],
  450. [
  451. {
  452. "param": "post_type",
  453. "operator": "==",
  454. "value": "post"
  455. }
  456. ]
  457. ],
  458. "menu_order": 0,
  459. "position": "normal",
  460. "style": "default",
  461. "label_placement": "top",
  462. "instruction_placement": "label",
  463. "hide_on_screen": "",
  464. "active": true,
  465. "description": "",
  466. "show_in_rest": 0
  467. }
  468. ]
  469.  
Advertisement
Add Comment
Please, Sign In to add comment