Add Itemprop image Schema in WordPress Posts regardless of your type of Theme or Theme Framework – its do-it-yourself guide without keeping hit or miss chance. We are supplying enough information for getting Itemprop image Schema in WordPress Posts in various ways, its not really that easy. There are hundreds of Themes, Theme Frameworks, Plugins which alters the default expected way WordPress works. Although Itemprop image Schema is possibly not that important at this moment, you might want a full schema things for your posts.
Itemprop image Schema : Basics of the DIY work
As said above, there is no ideal Plugin or Theme Framework that adds Itemprop image Schema nicely, our recommended Itemprop Plugin will not work here. So we need some basic PHP, WordPress functions, so that the custom data is added as meta, its a kind of compromise, but will work. The basics of this do-it-yourself work is depending on your skill, but these are important guides for the path :
Yes, you need either a modifiable plugin or change something in your functions.php file of Theme or Child Theme. Second one is difficult to say – it hugely differs. Plus browsers still needs some HTML data in normal, traditional way.
---
Itemprop image Schema : Understanding the Problems and Effective Snippets
The schema of image is here :
1 | http://schema.org/image |
So, properties of URL and Thing will come in to count. For practical purpose, we need :
- The itemprop markup itself
- The url of the image
- The url of the post
- May be description (= Excerpt)
- May be Author
- May be copyright
- May be dimensions
First method is to try to alter the image.php (or something named like that) of your theme or template where you will find to echo (The PHP function, notthe normal meaning) the href=”%s” to :
1 | echo apply_filters( 'Theme-Name_single_image_html', sprintf( '%s', $image_link, $image_title, $image ), $post->ID ); |
Quite unfortunately, there is no universal code – the parameters are too much varied.
Second way is to run SQL querry :
Its quite risky and you must know or rather master posts like this one – Indispensable MySQL queries for custom fields in WordPress.
We like to get HTML5 figure thing too, so a bit coding, either you can use as plugin or add it to functions.php file of theme :
Credits are given in the gist. Other complex way will be to return value in JSON format – kind of double filtering. Its too complicated to think though!
Tagged With itemprop=image