=== Local Business Schema Widget ===
Contributors: jamesmm
Tags: local business, local seo, schema, structured data, business hours
Requires at least: 6.3
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Show your business name, address, phone and hours with Schema.org LocalBusiness structured data, as a widget, block or shortcode.

== Description ==

Put your business contact details on your site and mark them up for search engines at the same time.

Local Business Schema Widget prints your business name, address, phone, hours and more as plain text styled by your theme, with Schema.org LocalBusiness structured data. Visitors and search engines read the same details from the same place, so your name, address and phone number match wherever you show them.

**What it does**

* Shows your business contact details as a widget, a block or a shortcode
* Adds Schema.org LocalBusiness structured data, as Microdata or as JSON-LD
* Offers 134 business types, such as Restaurant, Dentist, Plumber, Attorney and Store
* Makes the phone number, email and website clickable
* Marks up to four sets of business hours and shows them in your site's language and time format
* Lets you hide any group of details from visitors while keeping it in the structured data
* Covers price range, logo or photo, map link, social profiles, payment types and geo coordinates
* Has no settings page, adds no script or style files to your pages, and makes no outside requests

**Three ways to use it**

* **Block:** add the "Local Business Schema" block to any page, post or template and fill in the block settings sidebar. This is the way to use it with a block theme.
* **Widget:** in a classic theme, add "Local Business Schema" to a sidebar under 'Appearance > Widgets'.
* **Shortcode:** place `[local_business_schema]` anywhere shortcodes work.

Shortcode example:

`[local_business_schema type="Plumber" name="Acme Plumbing" phone="214-555-0100" street="100 Main St" city="Dallas" state="TX" zip="75201" hours1="Mo-Fr 8:00-17:00" hours2="Sa 9:00-13:00"]`

**Available Fields** *(all optional, blank fields are not shown)*:

* Business Type
* Business Name
* Text Description
* Logo or Photo
* Phone Number
* Fax Number
* Business Contact Email Address
* Business Website URL
* Physical Street Address, City, State/Region, Postal Code and Country
* Map Link
* Latitude and Longitude Coordinates
* Business Hours (4 sets)
* Price Range
* Payment Accepted
* Social Profile URLs
* Text/HTML Before, After and After Address

**Shortcode attributes**

* `type`: a business type from the list below, such as `Restaurant`
* `name`, `description`, `image`, `price_range`
* `phone`, `fax`, `email`, `website`
* `links`: `no` to print the phone, email and website as plain text
* `street`, `city`, `state`, `zip`, `country`, `after_address`, `map`, `lat`, `long`
* `hours1` to `hours4`: days and times, such as `Mo-Fr 9:00-17:00` or `Sa,Su 10:00-14:00`
* `hours_style`: `readable` (Mon-Fri: 9:00 am - 5:00 pm) or `compact` (Mo,Tu,We,Th,Fr: 9:00am-5:00pm)
* `payment`: any of `cash`, `check`, `credit`, `invoice`, `paypal`, separated by commas
* `social`: profile URLs separated by spaces
* `before`, `after`: text or HTML printed before and after the details
* `hide`: any of `name`, `description`, `image`, `phone`, `email`, `website`, `address`, `hours`, `price`, `payment`, separated by commas
* `format`: `microdata` or `jsonld`

**Available Local Business Types** *(list from schema.org)*:

LocalBusiness, AnimalShelter, ArchiveOrganization, AutomotiveBusiness, AutoBodyShop, AutoDealer, AutoPartsStore, AutoRental, AutoRepair, AutoWash, GasStation, MotorcycleDealer, MotorcycleRepair, ChildCare, Dentist, DryCleaningOrLaundry, EmergencyService, FireStation, Hospital, PoliceStation, EmploymentAgency, EntertainmentBusiness, AdultEntertainment, AmusementPark, ArtGallery, Casino, ComedyClub, MovieTheater, NightClub, FinancialService, AccountingService, AutomatedTeller, BankOrCreditUnion, InsuranceAgency, FoodEstablishment, Bakery, BarOrPub, Brewery, CafeOrCoffeeShop, Distillery, FastFoodRestaurant, IceCreamShop, Restaurant, Winery, GovernmentOffice, PostOffice, HealthAndBeautyBusiness, BeautySalon, DaySpa, HairSalon, HealthClub, NailSalon, TattooParlor, HomeAndConstructionBusiness, Electrician, GeneralContractor, HVACBusiness, HousePainter, Locksmith, MovingCompany, Plumber, RoofingContractor, InternetCafe, LegalService, Attorney, Notary, Library, LodgingBusiness, BedAndBreakfast, Campground, Hostel, Hotel, Motel, Resort, SkiResort, VacationRental, MedicalBusiness, MedicalClinic, CovidTestingFacility, Optician, Pharmacy, Physician, IndividualPhysician, PhysiciansOffice, ProfessionalService, RadioStation, RealEstateAgent, RecyclingCenter, SelfStorage, ShoppingCenter, SportsActivityLocation, BowlingAlley, ExerciseGym, GolfCourse, PublicSwimmingPool, SportsClub, StadiumOrArena, TennisComplex, Store, BikeStore, BookStore, ClothingStore, ComputerStore, ConvenienceStore, DepartmentStore, ElectronicsStore, Florist, FurnitureStore, GardenStore, GroceryStore, HardwareStore, HobbyShop, HomeGoodsStore, JewelryStore, LiquorStore, MensClothingStore, MobilePhoneStore, MovieRentalStore, MusicStore, OfficeEquipmentStore, OutletStore, PawnShop, PetStore, ShoeStore, SportingGoodsStore, TireShop, ToyStore, WholesaleStore, TelevisionStation, TouristInformationCenter, TravelAgency, MedicalOrganization, DiagnosticLab, VeterinaryCare

== Installation ==

1. In your WordPress admin go to 'Plugins > Add New', search for "Local Business Schema Widget" and click 'Install Now'. You can also upload the zip package with 'Plugins > Add New > Upload Plugin'.
1. Activate the plugin in 'Plugins > Installed Plugins'.

Then add the "Local Business Schema" block to a page or template, add the "Local Business Schema" widget to a sidebar under 'Appearance > Widgets', or use the `[local_business_schema]` shortcode. Enter the business details you would like to show.

== Frequently Asked Questions ==

= Does it work with block themes? =

Yes. Use the "Local Business Schema" block in a page, a post or a template such as the footer. The widget is for classic themes, which have widget areas under 'Appearance > Widgets'.

= Microdata or JSON-LD? =

Google Search reads structured data written as JSON-LD, Microdata or RDFa and treats all three the same when the markup is valid. Microdata marks up the text your visitors see. JSON-LD puts the same details in a script tag after the text, and is the format Google recommends when you have the choice. Pick either one under "Structured data format".

= Will this change how my business appears in search results? =

Structured data helps search engines understand what is on a page. Google does not guarantee that features which use structured data will show up in search results.

= How do I check the markup? =

Enter the address of a page that shows your details into Google's [Rich Results Test](https://search.google.com/test/rich-results) or the [Schema Markup Validator](https://validator.schema.org/). Both list the structured data they find on the page.

= Can I show more than one business or location? =

Yes. Each widget, block and shortcode has its own details and prints its own business.

= Will my saved widget keep its settings when I update? =

Yes. A widget saved by an earlier version keeps its settings and prints exactly what it printed before. The new options, such as clickable contact details, are off for those widgets until you turn them on.

= Can I put HTML in the Text/HTML fields? =

Yes. In the widget, as with the Custom HTML widget in WordPress, users who are allowed to post unfiltered HTML have their markup saved as typed, and for other users it is filtered when the widget is saved. In the block and the shortcode the markup is always filtered, the same as post content.

== Screenshots ==

1. The Local Business Schema block and its settings in the editor
2. Business details on a page
3. The widget settings in a classic theme

== Changelog ==

= 1.1.0 =
* New: Local Business Schema block, for pages, posts and block themes.
* New: `[local_business_schema]` shortcode.
* New: JSON-LD output as an alternative to Microdata.
* New: clickable phone, email and website.
* New: price range, logo or photo, map link and social profiles.
* New: four sets of business hours, with an option to show them in the site's language and time format.
* Updated the business type list from schema.org: 134 types, 10 of them new.
* Renamed to Local Business Schema Widget. The widget is now listed as "Local Business Schema".
* Widgets saved by earlier versions keep their settings and print exactly what they printed before.

= 1.0.0 =
* Works on PHP 8. Version 0.3.0 stopped the site with a fatal error on PHP 8.
* Security: every field is escaped when it is printed, and the Text/HTML fields are filtered on save for users who may not post unfiltered HTML.
* Fixed: a blank business name no longer prints an empty line.
* Fixed: blank opening and closing times are no longer saved as 00:00.
* Fixed: business hours set 2 is shown when set 1 is not used.
* Fixed: the country is now part of the address markup when the address is displayed.
* Fixed: missing city, state or zip no longer leave stray punctuation in the address.
* Schema.org addresses now use https.
* The "get coordinates" link points to a working page.
* Translations now use the plugin's own text domain, local-business-microdata-widget.
* Now requires WordPress 6.3 and PHP 7.4.

= 0.3.0 =
* Added field for specific Local Business type from Schema.org
* Added PaymentAccepted field

= 0.2.1 =
* Fixed business hours set 2 from showing when days not set
* Added label class to field labels

= 0.2.0 =
* Corrected localizing/internationalizing issues, THX Piet!
* Increased security: prevented direct access to the file, THX Piet!
* Added field to display after address
* Added country field to physical address
* Added business hours
* Added functionality to hide elements from display
* Improved readme, screenshots, typos, THX Bob Riley!

= 0.1.0 =
* Initial version.

== Upgrade Notice ==

= 1.1.0 =
Adds a block, a shortcode, JSON-LD output and more fields. The plugin is now named Local Business Schema Widget. Saved widgets are unchanged.

= 1.0.0 =
Required for PHP 8. Fixes the fatal error in 0.3.0, escapes all output and keeps your saved widget settings.
