Welcome Guest! Login? Checkout

If you run a business directory for your local area one way in which to improve each listing is to provide each business listing with it’s own Uber button. Uber is a taxi service where people could order taxis from their phones, and is popular in most major cities worldwide. As such, if you have Uber available in your cities, it’s a great selling point to add it to your business directory. More and more people have asked me about this, so I’ve decided to write a post that will detail how to Integrate Uber into WordPress business directory.

First and foremost, you need WP Taxi Me Premium to do this. The functionality described in this blog post needs the premium addon for this to work. So get it and come back to me when ready.

The wptaxime_build_button() Function

Everything is run off one function, the wptaxime_premium_build_function( $atts ) function. This function – as the name suggest, builds the button for WP Taxi Me. It accepts one argument, an array.

The Attributes Array

The attributes array contains details of the destination where – when you click – you will open Uber with details of your businesses destination. This array is being extended quite a bit but at the time of writing the following details are present:-

  • name – This is the name of the business. Purely for display purposes only.
  • address_1 – The first line of the address.
  • address_2 – The second line of the address.
  • state – The state or county of the business.
  • zip – The zip or postcode of the business.

All need to be present on your address, you also need to add something else to your array. This option is get_new_latlng which will need to be set to TRUE. The plugin caches latitudes and longitudes as they are unlikely to change usually but in this case you want a change so make sure this is set to true.

Example Code

So here’s an example array you would use on a template. I’ve imagined this on a template from a single listing, and should be put within the WordPress loop.

You will need to change the post_first_address_line to your theme’s custom meta for those values. This should help display multiple buttons on your site. But this will only work with WP Taxi Me Premium, so you must have this.

Using Latitude & Longitude Instead

If you don’t have an address, but instead have a latitude & longitude, you can the same function. This time however you will need to use 3 separate functions:-

  • name – This is the name of the business. Purely for display purposes only.
  • lat – The latitude of the business.
  • lng -The longitude of the business.

That is all you need to get a business by latitude and longitude. Similarly to the previous code example, here is how to do it using coordinates.

Are You A Theme Author?

I’m keen to work with Theme Authors to help integrate WP Taxi Me with themes to help cross promotion. If you have a Business Directory theme or keen for cross promotion, then please feel free to contact me.

 
 
 
WP Engine Managed WordPress Hosting

Comments

Polite Disclaimer: I am welcome, open and willing for corrections to be shared in the comments (with corrections being added to posts and credited), and the comments field should be used to promote discussion and make this post better. I do not know everything and if anybody finds a better way to do something, then by all means please share it below.

However, I'm unable to offer support to posts. The reason being is that WordPress has tens of thousands of plugins and millions of themes. As such, finding out exactly why code doesn't work with your setup is a long process. If you wish for me to look at your code, please use the priority support area.

Comments asking support will be left on the site, but there is no guarantee of answer.

    Comments are closed.