Plugin Directory

Changeset 1848051


Ignore:
Timestamp:
03/27/2018 10:42:13 PM (8 years ago)
Author:
bdeleasa
Message:

Adding checks for whether the address parts are empty before adding the schema markup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-company-info/trunk/classes/class-wp-company-info-contact-info.php

    r1848050 r1848051  
    322322
    323323            // Format the city
    324             $address['city'] = '<span itemprop="addressLocality">' . $address['city'] . '</span>';
     324            if ( ! empty($address['city']) ) {
     325                $address['city'] = '<span itemprop="addressLocality">' . $address['city'] . '</span>';
     326            }
    325327
    326328            // Format the state
    327             $address['state'] = '<span itemprop="addressRegion">' . $address['state'] . '</span>';
     329            if ( ! empty($address['state']) ) {
     330                $address['state'] = '<span itemprop="addressRegion">' . $address['state'] . '</span>';
     331            }
    328332
    329333            // Format the zipcode
    330             $address['zip'] = '<span itemprop="postalCode">' . $address['zip'] . '</span>';
     334            if ( ! empty($address['zip']) ) {
     335                $address['zip'] = '<span itemprop="postalCode">' . $address['zip'] . '</span>';
     336            }
    331337
    332338            // Format the country
Note: See TracChangeset for help on using the changeset viewer.