How to hide Itemprops in website

This topic contains 8 replies, has 3 voices, and was last updated by  Abhishek Modi 8 years, 7 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket

Tagged: 

  • Author
    Posts
  • #55496

    Abhishek Modi
    Buyer
    Post count: 205

    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
    In

    Time: 9pm to 12pm

    With Hidden Code
    ADDRESS: C-8, Indiranagar, Hyper Society, Bangalore

    Time: 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

    #55503

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hello,

    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

    #55512

    Abhishek Modi
    Buyer
    Post count: 205

    Ya 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

    #55522

    Abhishek Modi
    Buyer
    Post count: 205

    Hi, 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

    #55527

    Abhishek Modi
    Buyer
    Post count: 205

    Apologies ignore the Last Reply, Posted by Mistake.

    Thanks

    #55540

    Guust
    Moderator
    Post count: 29970
    #55575

    Abhishek Modi
    Buyer
    Post count: 205

    Thanks 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

    #55579

    Guust
    Moderator
    Post count: 29970

    Try something like

    span[itemprop="addressCountry"] + br{display:none;}
    #55580

    Abhishek Modi
    Buyer
    Post count: 205

    Perfect 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 🙂

Viewing 9 posts - 1 through 9 (of 9 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket