Quantcast
Channel: Adding schema to meta -tag: wordpress - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Answer by Kvvaradha for Adding schema to meta -tag: wordpress

$
0
0

do it like this on your header.php

<html <?php html_tag_schema(); ?> <?php language_attributes(); ?>>

and you need to write the function html_tag_schema() now. write the below function on your active theme's functions.php

function html_tag_schema(){$schema = 'http://schema.org/';// Is single postif(is_single()){    $type = "Article";}// Contact form page IDelse if( is_page(1) ){    $type = 'ContactPage';}// Is author pageelseif( is_author() ){    $type = 'ProfilePage';}// Is search results pageelseif( is_search() ){    $type = 'SearchResultsPage';}// Is of movie post typeelseif(is_singular('movies')){    $type = 'Movie';}// Is of book post typeelseif(is_singular('books')){    $type = 'Book';}else{    $type = 'WebPage';}echo 'itemscope="itemscope" itemtype="' . $schema . $type . '"';}

I hope this one solves your problem


Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>