How to hide Itemprops in website
This topic contains 8 replies, has 3 voices, and was last updated by Abhishek Modi 10 years ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: Geodirectory
-
AuthorPosts
-
October 2, 2015 at 3:34 pm #55496
Hi, I need to hide the Country, Region and City Itemprops from website. So i have added the following in custom field functions.php >>
<span class=”hidden” itemprop=”addressRegion”>Bangalore</span>
<span class=”hidden” itemprop=”addressLocality”>Indiranagar</span>
<span class=”hidden” itemprop=”addressCountry”>India</span>And it worked but itemprop space is still there, could you please help me how to remove that blank space.
Without Code
ADDRESS: C-8, Indiranagar, Hyper Society, Bangalore
Kolar Road
Bhopal
InTime: 9pm to 12pm
With Hidden Code
ADDRESS: C-8, Indiranagar, Hyper Society, BangaloreTime: 9pm to 12pm
As space is still there display none is not working. My purpose is to hide itemprops on website and make it Google readable.
Thanks
October 2, 2015 at 4:17 pm #55503Hello,
I am not sure why you are trying to do this, do you know it needs to be visible for Google to use it in search results?
Thanks,
Stiofan
October 2, 2015 at 4:40 pm #55512Ya as far i know it will be visible to google as its there but hide on pages.
http://stackoverflow.com/questions/8903526/is-it-ok-to-hide-microdata-with-css
Also i’m very sure about the technique as the planet biggest site of food also doing the same(zomato). If you check there detail listing pages did the same.
Actually its looking quite awful, also it is taking too much space in listing pages. Previously i removed from site but that also remove the structured data also that Google reads. This time i’m sucessful but with blank space left.
Thanks
October 2, 2015 at 7:17 pm #55522Hi, Got the function to remove hentry class from gd post types and its working fine, Now No Errors. But its working on pages also and removed the entry page Title, As this pages dependent on WordPress structure.
Here is the code:
add_filter( 'post_class', 'remove_hentry_function', 20 ); function remove_hentry_function( $classes ) { if( ( $key = array_search( 'hentry', $classes ) ) !== false ) unset( $classes[$key] ); return $classes; }Thanks
October 2, 2015 at 7:52 pm #55527Apologies ignore the Last Reply, Posted by Mistake.
Thanks
October 2, 2015 at 11:21 pm #55540Have a look here:
https://wpgeodirectory.com/docs/how-to-use-gd-without-street-addresses/
Maybe that helps.October 3, 2015 at 7:21 am #55575Thanks Guust, I have tried already everything and it is hiding itemprops as well but with blank space left.
PFA Images. First Image without Display:none and
Second image display:none to itemprops. Here is the code:span[itemprop="addressLocality"] { display: none; } span[itemprop="addressRegion"] { display: none; } span[itemprop="postalCode"] { display: none; } span[itemprop="addressCountry"] { display: none; }Why blank is there even on display:none;
Thanks
October 3, 2015 at 7:45 am #55579Try something like
span[itemprop="addressCountry"] + br{display:none;}October 3, 2015 at 7:57 am #55580Perfect Guust that did the trick. But its working when we add old code as well. Something like this:
span[itemprop="addressLocality"] { display: none; } span[itemprop="addressRegion"] { display: none; } span[itemprop="postalCode"] { display: none; } span[itemprop="addressCountry"] { display: none; } span[itemprop="addressLocality"] + br{display:none;} span[itemprop="addressRegion"] + br{display:none;} span[itemprop="postalCode"] + br{display:none;} span[itemprop="addressCountry"] + br{display:none;}Thanks a Lot Guust this is what i want 🙂
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket