natewr / business-profile Goto Github PK
View Code? Open in Web Editor NEWWordPress plugin to display your business's contact details with seo-friendly Schema.org markup.
WordPress plugin to display your business's contact details with seo-friendly Schema.org markup.
=== Business Profile === Contributors: NateWr, fatmedia Author URI: https://github.com/NateWr Plugin URL: http://themeofthecrop.com Requires at Least: 4.4 Tested Up To: 5.1 Tags: business profile, seo, local seo, schema, address, google map, contact, phone Stable tag: 1.2.6 License: GPLv2 or later Donate link: http://themeofthecrop.com Display your business's contact details with seo-friendly Schema.org markup. Supports a Google Map, opening hours and more. == Description == Add your business contact details to your site with seo-friendly Schema.org markup. This plugin adds a Contact Card block for the Gutenberg editor, a widget and a `[contact-card]` shortcode. You can use these to display the following on any page: * Business name * Address * Phone number * Contact page link or email address * Link to Google Map with directions to your establishment * Google Map showing your location * Opening hours Schema.org markup helps search engines like Google discover your address, phone number and opening hours so that they can display them with your listing on Google. Supports [multi-location businesses](http://doc.themeofthecrop.com/plugins/business-profile/user/getting-started/locations) with a custom Locations post type. This plugin is part of a suite of plugins for restaurants. [Take online reservations](https://themeofthecrop.com/plugins/restaurant-reservations/?utm_source=Plugin&utm_medium=Plugin%20Description&utm_campaign=Business%20Profile) and build [responsive online menus](https://themeofthecrop.com/plugins/food-and-drink-menu/?utm_source=Plugin&utm_medium=Plugin%20Description&utm_campaign=Business%20Profile) at [Theme of the Crop](https://themeofthecrop.com/?utm_source=Plugin&utm_medium=Plugin%20Description&utm_campaign=Business%20Profile). = How to use = View the [help guide](http://doc.themeofthecrop.com/plugins/business-profile/?utm_source=Plugin&utm_medium=Plugin%Description&utm_campaign=Business%20Profile) to learn how to set up and display your Business Profile. = Developers = This plugin is packed with templates and hooks so you can extend it as needed. Read the [developer documentation](http://doc.themeofthecrop.com/plugins/business-profile/developer/). Development takes place on [GitHub](https://github.com/NateWr/business-profile/), so fork it up. == Installation == 1. Unzip `business-profile.zip` 2. Upload the contents of `business-profile.zip` to the `/wp-content/plugins/` directory 3. Activate the plugin through the 'Plugins' menu in WordPress 4. Go to the Business Profile page in your admin menu. You will find it near the bottom. == Frequently Asked Questions == = Is there a shortcode to print the contact card? = Yes, you can use `[contact-card]`. The documentation includes [all of the shortcode attributes](http://doc.themeofthecrop.com/plugins/business-profile/user/faq#shortcode). = It asks me for a Google Maps API Key but I don’t know what it is or how to get it. = Google now requires that you have your own API key to display a map on your website. The documentation includes a walkthrough to help you [generate a Google Maps API key](http://doc.themeofthecrop.com/plugins/business-profile/user/faq#google-maps-api-key). = Google Maps shows my business in the wrong location = Unfortunately, in some cases Google is unable to find the right latitude and longitude to match your address. In some cases, you may be able to get it to properly locate you by tweaking the address. Sometimes Google just needs a bit of help. Once you’ve got the right coordinates you can go back and restore your original address, and save the form without touching the coordinates again. If you’re unable to get Google to recognize your location, the best thing to do is to leave the Google Map out when you print your contact card. You will also want to hide the Get Directions link, because Google will guide your customers to the wrong location. There’s not much I can do about this, unfortunately. Even if you were able to manually set the latitude and longitude, Google would still show bad directions, because it uses the address, not the coordinates, for this feature. = What’s the Schema Type? = This allows you to let search engines like Google know exactly what kind of business you run. That way, when someone looks for a real estate agent or a restaurant in your area, they’ll know to include you in their search results. You may not find a type that’s a perfect match for your business. Choose the option that’s most appropriate for your business, and fall back to a more generic type, such as Local Business, if you need. = More questions = You'll find more help in the [User Guide](http://doc.themeofthecrop.com/plugins/business-profile/user/). Developers interested in templates, filters and theme support can view the [Developer Documentation](http://doc.themeofthecrop.com/plugins/business-profile/developer/). == Screenshots == 1. Display a full contact card on the front-end with the shortcode [contact-card] or use the widget to add it to a sidebar. 2. An easy-to-use form lets you add all of the information, locate the correct map coordinates and set up your opening hours. 3. Choose what information to display with the widget, or check out the shortcode attributes in the help document included. 4. Optional multi-location support to easily display all of your locations. 5. Add a contact card to any page or post with the block. == Changelog == = 1.2.6 (2019-04-04) = * Fix: Version naming issue. Corrects the 1.2.5 release. = 1.2.5 (2019-04-04) = * Fix: error when adding a new location = 1.2.4 (2019-03-18) = * Fix: date and time picker error in Chrome in pickadate.js library = 1.2.3 (2018-12-14) = * Fix: fatal error in old versions of PHP (< 5.4) = 1.2.2 (2018-12-12) = * Fix: contact card block loads in editor without saved location = 1.2.1 (2018-12-11) = * Update: .pot file with new translation strings = 1.2 (2018-12-11) = * Add: gutenberg block for the contact card = 1.1.5 (2018-09-26) = * Fix: Address coordinate lookups need to be https:// and use api key = 1.1.4 (2017-04-21) = * Add: business image to comply with Google requirements = 1.1.3 (2017-03-21) = * Fix: Fatal error with location schedule metabox = 1.1.2 (2017-03-14) = * Fix: Don't display contact card for unpublished locations * Fix: PHP Notice on post editing page (h/t @robneu) * Add: Italian and Swedish translations (h/t @lucspe and Daniel Schwitzkey) * Update: Always instantiate post type class * Update: Give settings table rows class attributes (h/t @lucspe) = 1.1.1 (2016-06-28) = * Add field for Google Maps API Key to follow new API guidelines = 1.1 (2016-06-20) = * Add: multi-location support * Add: filter to adjust available schema types * Add: templates for contact cards and opening hours * Add: helper functions for templating * Add: add_theme_support() args for disabling scripts, styles and append to content * Update: implement WP coding standards. h/t @robnue = 1.0.9 (2016-02-12) = * Fix: compatibility with wp-cli * Fix: allow short weekday names to be translated * Update: "get directions" link now opens in a new window/tab * Update: widget now uses shortcode to print output * Update: remove deprecated sensor attribute from Google Maps api call * Add: make Google Maps objects and options available in global scope * Add: allow map options to be filtered * Add: javascript event triggered when map initialized = 1.0.8 (2015-10-01) = * Update: Simple Admin Pages lib to v2.0 (#27) * Fix: line breaks can disrupt get directions link in embedded map (#17) = 1.0.7 (2015-10-01) = * Add: show shortcode on business profile page * Add: obfuscate email address if displayed in contact details * Fix: compatibility problems when the Google Maps API is already loaded * New and updated translations: Dutch, Hebrew, Spanish (Colombia), Portugese, Spanish, Czech = 1.0.6 (2015-04-03) = * Fix: validation errors with address markup * Fix: validation errors with contactPoint markup = 1.0.5 (2014-09-21) = * Fix: restore lost option to show contact info in widget options when Restaurant Reservations is activated = 1.0.4 (2014-09-11) = * Fix: contact link/email doesn't get shown. = 1.0.3 (2014-09-04) = * Fix: swapped desc/url meta values. h/t @thatryan = 1.0.2 (2014-07-16) = * Update Simple Admin Pages library to v2.0.a.7 = 1.0.1 (2014-07-16) = * Fix character-case error and rename integrations file for better standardization = 1.0 (2014-07-16) = * Initial public release on WordPress.org * Add an option to display a link to a booking form if the Restaurant Reservations plugin is active * Fix: skip a scheduling rule if no weekdays are set. h/t @jasonhobbsllc = 0.0.1 (2014-05-26) = * Initial release == Upgrade Notice == = 1.2.6 = This update fixes a fatal error when adding a new location. = 1.2.5 = This update fixes a fatal error when adding a new location. = 1.2.4 = This update fixes a bug in the latest version of Chrome with the date and time picker in the scheduler. = 1.1.5 = This update fixes the address coordinate lookup, so that coordinates can be set for more reliable Google Map display. = 1.1.4 = This update adds a new image setting, which Google now requires for local businesses. You're strongly encouraged to add an image for your business. = 1.1.3 = This update fixes a critical bug when trying to add or edit a location's opening hours. = 1.1.2 = This minor update fixes a few obscure bugs and prevents the [contact-card] shortcode from displaying an unpublished location. It also adds Italian and Swedish translations. = 1.1.1 = This update adds support for a Google Maps API Key. Since June 22, 2016, Google Maps will require all _new_ websites to use an API key in order to display maps. Instructions can be found near the new API Key field in your Business Profile. = 1.1 = This major update adds support for multiple locations, refactors the codebase to follow WP coding guidelines, and adds several templates and helper functions for customization. = 1.0.9 = This update fixes wp-cli compatibility and adds a number of useful development filters/features for interacting with the map objects. = 1.0.8 = This update fixes an error in the Get Directions link that appears inside of embedded maps. I recommend you update as it likely effects a lot of people. = 1.0.7 = This update fixes some compatibility problems with third-party plugins or themes, disguises the email address if displayed, and updates a bunch of translations. = 1.0.6 = This update fixes validation errors with the address and contact point schema.org markup. It is strongly recommended that you update to improve Google compatibility. = 1.0.5 = This minor update fixes a problem in which the option to show or hide the contact details in a widget had disappeared. = 1.0.4 = This minor update fixes a problem in which a contact page or email address wouldn't get printed with the contact card. = 1.0.3 = This minor update fixes a problem in the Schema.org markup where your business description and URL got mixed up. = 1.0.2 = This version updates a library used by the plugin to increase compatibility with the other plugins in my restaurant plugin suite. = 1.0.1 = This update fixes a letter-case bug that may effect some installations. = 1.0 = This initial public release adds an integration with the Restaurant Reservations plugin. If the plugin is active it will now let you display a link to the booking form.
Had a client that not want the default view of the Google map, as the address was already displayed above the map - they instead wanted the PIN that would open to the address when clicked.
and then when the PIN is clicked shows the address
I got the functionality needed with MapPress - https://wordpress.org/plugins/mappress-google-maps-for-wordpress/
Was wondering if the map component can be manipulated in Business Profile as it currently stands.
Hey there, This is awesome thanks. I am trying to extend it a bit to add a formatted phone number option so I can output it as a tel: href to activate calling. I have it (mostly) working, added a setting, and added getter to the template-functions, but when I output the data I am getting an error call_user_func() expects parameter 1 to be a valid callback
and am not sure I follow how the callback part is supposed to work... Any input?
Thanks!
On my customers websites I usually give them a slightly lower that full administrator role permissions. This is so that I can protect some sensible areas where they could introduce problems.
Problem is I need to allow them to manage business-profile details but that seems to be accessible only by administrators.
Is there any way I can customize this?
I'm considering making the jump to the JSON-LD format. It's what Google recommends, it will reduce the burden of tying the output to the schema, and prevent the situation where we're loading lots of rich markup objects on a single page just because we want to display the details in multiple places. It will also make it easier to inject data (like menus) into the overall entry.
The goal is to:
@robneu do you have any thoughts on this?
Allow the opening_hours_brief
argument to accept a string for display instead of trying to generate it's own, so that users can opt for a more human-readable format, like "12-6pm Mon-Fri".
The custom post type for locations can be activated/deactivated from the Business Profile page, so when it's saved we should flush the rewrite rules.
Throwing a warning (not error) in console because the sensor attribute is no longer required:
https://developers.google.com/maps/documentation/javascript/error-messages
https://github.com/NateWr/business-profile/blob/master/assets/js/map.js#L13
Do you have any plans to add support for multiple locations? Would you be interested in a pull request to add them?
Yoast SEO adds JSON-LD script tags with basic website/business info. Perhaps this plugin needs to account for that if the plugin is active and pull business details from Yoast?
https://www.youtube.com/watch?v=zkccU4sqeB8&list=PL4CtPfBUilirZovJVGPHoMH-JOMWSpWoa&index=2
Right now the plugin injects the Google Maps API script after the page is loaded. This improves page load speed a little bit, but the cost is that it's very difficult to manage conflicts.
If another plugin enqueues the Google Maps api as well, this can cause conflicts, for example with Modern Tribe's Events Calendar plugin. So they need to be able to dequeue the API script without disabling the map view in our plugin.
This presents a bit of an issue around how the maps are loaded. We are passing an initialize
callback to the API as a query var, so that our maps spin up as soon as the API is loaded. If we continue to use this technique, dequeuing the API call will also disable our maps.
On the other hand, if we don't use the callback technique, we'll need to implement some kind of listener that checks when the API is loaded. I'm not super happy about that. It just seems like a lot of hassle. It might be worth diving into the Google Maps API to see if they emit any kind of loaded
event we can listen to.
This is a pretty minor detail, but the plugin triggers a number of warnings and errors when running the WordPress PHP_CodeSniffer sniffs. If this is something you'd like to leave as-is, no big deal.
If you'd like to make the plugin more compliant, we could work on getting things updated as part of the process of building out the multiple locations feature. I'd be happy to either work the fixes in through my feature PRs or do them all in one shot with a WPCS pull request.
All the text can be translated, but a lot of English speakers are just not familiar with how to use translations. Some of the key phrases, like "Get Directions" and "Opening Hours" should be filtered for easy modification.
The plugin header file still points to the old textdomain, bpfwpdomain
, but should indicate business-profile
.
The add/edit interface for location
posts should support post meta in the format described in the locations standard.
Previous discussion in #6.
We don't actually tell the user how to use it anywhere other than the widget.
See this.
I have not set the map co-ords, but still getting a map shown when using the shortcode on a page.
Example - http://dev.fitmum.autopilotyourbusiness.com/contact/ It seems to be match based on the company name - but these are matching companies from different countries.
Check if Schema.org has any particular requirements for marking up multiple locations of the same business.
Multiple locations will be defined in a location
custom post type that follows the (work-in-progress) standard as closely as possible. The custom post types should be "activated" through a toggle in the main profile settings page. When activated, menu items for Locations and Add Locations will appear under the Business Profile link.
Previous discussion can be found in #6.
Google drops the ball for quite a few addresses, not locating them correctly. Perhaps next to the coordinate "View" button there should be an "Edit" button to enter them manually.
Someone recently asked me if it's possible to add a more specific business type such as InsuranceAgency. A method for doing it via a filter didn't jump out at me and I was wondering if you'd be willing to add these sub-types in to the default options array.
If so, I'll gather up a list of all of them and set up a PR. I can also add some filters to make it easier for developers to add new sub-types if they're added to the spec before we have a chance to include them.
bp_maps should be global (perhaps under a more protected name) and maybe it would be nice to be able pass a JSON hash with options via wp_localize_script
that would be used in the options hash.
Hi,
I was looking to have the plugin translated to Portuguese and Im seeing that it already has translation files for that, although those files aren't included when installing the plugin from wordpress.org.
Anything can be done about this?
Cheers.
I was wondering if you've run into any issues using a constant for the textdomain rather than hard-coding it? It's my understanding that this can cause problems with programs like GNU Gettext.
The [contact-card]
shortcode needs to be able to handle multiple locations. It should also use a template loading technique as discussed in #6.
location
arg (use post ID) f2558b9Right now it goes direct to bpwfwp_print_contact_card()
so if someone has replaced the shortcode it doesn't show the replaced output.
Being output in WP 4.5.2 & BP 1.1
Notice: Trying to get property of non-object in /srv/www/allwater/htdocs/wp-content/plugins/business-profile/business-profile.php on line 207
Arguments:
disable_styles
- Whether or not to load frontend stylesheets. Default: false
disable_scripts
- Whether or not to load frontend scripts. Default: false
disable_append_to_content
- Whether or not to automatically append a contact card to the_content
in location single.php
. Default: false
The addition of the booking link should be handled by the Restaurant Reservations plugin rather than Business Profile.
NateWr/restaurant-reservations#58
The way it's handled now in BP makes it hard to have a generic function available to call, because it's nested in a class. Implement in the reservations plugin then deprecate this technique.
It looks like the display address is not being recognized by Google's Rich Snippets tool. The address gets recognized when show_address
is set to false. In this case, the plugin prints the address into the content attribute on a meta
tag.
I think this is because only the content
attribute supports a single-string address. A full schema object wants a fully-specified PostalAddress.
The template tag should be refactored to always print the address into the content attribute of a meta tag. Then we can remove the schema markup from the display markup if it's printed.
An extra widget could display whether a business is open right now or what the current day's opening hours are.
Original request:
https://wordpress.org/support/topic/request-google-style-next-open-time?replies=1#post-8759542
Currently the Google Map "Get directions" link opens in a new window/tab within the browser.
However this is not the case for the "Get Directions" links in:
Solution:
An option to have the links open in a new window/tab would be nice.
Recommended by lmartins. Not sure if it's going to be very effective or if there are side effects for some email clients reading the address. But worth investigating.
Hello,
our store is enlisted in google maps, but providing an address in site does not match the map. Can I manually set the coordinates? or how can I match the google list?
Hi again :)
So noticed an issue when clicking on 'get directions' from inside of the map content box, it fails to get directions because the URL parameter, in my case, has a <br>
in it. Works find where the address link is printed via PHP, but the
encodeURIComponent( data.address )
Is not removing the break tag. I am trying to figure out how to strip and clean it for the address, but thought I would post it for you to see also.
Currently the print functions are pretty naive and don't actually check if data exists before printing it out. It would be nice if they handled that themselves.
Google now seems to expect an image
object for FoodEstablishment
types. Maybe for all LocalBusiness
types.
https://search.google.com/structured-data/testing-tool/u/0/#url=demo.themeofthecrop.com%2Fluigi
Research what's behind this new requirement and add an ability to support this.
We may be able to pull an image automatically from the new site_logo
theme option, or Yoast SEO settings.
Users may wish to use a location's post_content
when displaying it via shortcode or widget.
I have a custom plugin that adds an alternative phone to the default settings screen on Business Profile and at a quick glance I didn't see any way to easily add the same data to individual locations.
I think all that would be needed is an extra do_action within the meta box itself and the callback used for saving the extra meta as well.
It's also possible that I've just missed it entirely or that you prefer people register their own custom meta boxes rather than expand on the existing ones.
When a contact card appears on a page that is the same as the Contact Page setting, and no contact email has been set, it should load the contact as a hidden meta key instead of link. The link will just reload the page.
An address like this:
123 Street
Some Town, USA
Can become this:
?address=123+StreetSome+Town,+USA
Need to replace new lines with a space or comma when the URL is generated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.