Pages

June 5, 2016

WordPress Radius Calculation For Store Locator using Google Map



H
ave you ever had a chance work on the store locator project? Where you have to display the store using Google Map in given radius from the user's position (or say latitude longitude of user)? 
I recently had work on store locator project, Where in I have to customize the store locator functionality made using WordPress. 

The situation get worse when I found that the latitude and longitude of the store is stored in the `wp_meta`! This makes it more complex to calculate the distance of the stores.
After so much time spend in searching and thinking how to best fit the Google Map Distance calculation query with meta key and value format, I figure out the solutions. 

The solution was to not to use the lat, long meta data in the Google Map Distance calculation query for two reason.
  1. Its overwhelmingly complex to use meta value in Google Map Distance calculation query, (I know you know it, right?)
  2. The query will be incredibly slow while fetching the data, that will ultimately make your website look slow.

But, At the same time I cannot change the way lat and long are stored. 

The Solution I adopted was to use separate table for the lat long processing. 

This is comparatively very easy than earlier solution (with no change in current flow, off course). 

All I have done is to just use "save_post" hook and written code to save the post value in custom table. 

Like the example given below.
Write this code at the end of  `function.php` or you can make your own plugin (recommended).


Then you can apply the following query to get the store id for the given distance from the users latitude and longitude.

To search by kilometers instead of miles, replace 3959 with 6371 in the query.

That's it, thats all you need. Your store search should be working by now.

Do you find this article helpful? Don't forget to give your comment below.
Cheers.
GautamArya

October 5, 2014

UPS Shipping Rate Calculation API – Part 1


R
 ecently, I was working on the ups shipping rate calculation API. It was an e-commerce site using UPS Shipping service delivering its order.

First of all working with UPS shipping rate calculation API is simple. You first need to register yourself on ups site. You will get username, password and API key and UPS account number.

Now create a file with ‘ups_shipping_process.php’ name, and put following code in it.
Then create another file with `calculate_shipping_cost_ups.php` and put following code in it.
Set your credentials you got from UPS registration by calling ‘setCredentials()’ method, Replacing UPS_ACCOUNT_KEY, UPS_USERNAME, UPS_PASSWORD, UPS_ACCOUNT_NO with your real information.
You can set your Country, ZIP code, and measurement UNIT (i.e.  LBS or KG for weight and IN for dimension)
Below are the option for the shipping method, you might wants to use in your for user selection.
For Advance Configuration of the UPS Shipping Rate Calculation visit:

May 16, 2014

WordPress interview questions and answers

What is the Difference Between Posts vs. Pages

Posts vs. Pages
* Posts are timely vs. Pages are timeless.
* Posts are social vs. Pages are NOT.
* Posts can be categorized vs. Pages are hierarchical.
* Posts are included in RSS feed vs. Pages are not.
* Pages have custom template feature vs. Posts do not.

April 17, 2014

Create an Access token for twitter.



Have you ever caught up in a situation like you need to show the tweets on your website, for that you’ve created an application in dev.twitter.com but you don’t know where the hell is access token and access secret?

April 14, 2014

Extract images and text from post content WordPress

Hey There, Ever had a post with lots of images in it and you wanted text and images displayed separately from the post content?
Well, before a week ago I got exactly same situation where I need to display images from post content on the top and the text under it. It was a blog page of the site and showing excerpt there.
Showing the text only without image wasn’t difficult. I applied this php code and it’s done.

 echo substr(preg_replace('/<img />]+./','',$post->post_content),0,350); 
But extracting the images especially multiple from post content and showing them on the top of the blog entry was a little bit tricky part of this job.
So, what I did to extract images from post content is put this code where I need images to be displayed
  

March 29, 2014

Pagination with special recent post Plugin


Today, I'm going to show you how to add pagination with Special recent post Plugin.
If you are using special recent post plugin to show recent posts in your blog website.
You might have stuck with pagination problem i.e. what If you have 100 post and you want to show 10 posts per page?

I've made some custom changes in the special recent post plugin to made it work with pagination.
Follow these instructions to add pagination.
First we need to set the plugin is fetching the posts from the database so we need to set the offset option into the queries option so we can say what page number is requested and fetching from number of post up to 10 or whatever post you need to show in one page.
Go to the "special recent posts"  plugin now go to class directory of it. You'll find a file

class-main.php

Open it.

February 20, 2014

WordPress Plugin - Sidebar Pages Menu



Follow these very simple steps to Show menu in the sidebar of your WordPress.


  1. Log into WordPress admin area of your site.
  2. First install this Siebar Menu Widget  Plugin.
  3. Now Go to menu and create a new menu and then add the page you want to display in sidebar.
  4. Now go to widget area drag and drop the menu in the sidebar and select the menu from drop down.
That’s all. It’s that simple.

If you like this post you can like, share or comment. Subscribe the blog to get regular update on many web development articles and latest technology news.

October 12, 2013

Points of SEO

The Basics
If your website isn’t properly optimized on-page, your efforts off the website (link building, content marketing, social media) probably won’t yield substantial results. Not that they won’t generate anything at all, but more than half your efforts may end up going down the drain.
There’s no clear rule book that says: do X, Y, and Z in on-page optimization and your rank will rise by A, B, or C. On-page optimization is based on tests, analytics and errors. You learn more about it by discovering what doesn’t work than what does.

October 1, 2013

Customize WordPress Menu.

If you’re trying to make a fancy navigation menu with CSS, you might have found the default IDs and classes applied by WordPress to the nav menu elements to be quite lacking. However, you can fix that by adding a custom walker function to add your own conditional classes. The custom nav walker function I made below will add the following CSS classes:

September 26, 2013

5 SEO Don'ts


#1: Using the wrong keywords 

If your website doesn't use the same words that the people searching for you do, your content will never show up for those searches or be seen by the right people.
The solution? You can use Google Insights for Search to compare potential keywords,

September 25, 2013

Gmail's New Tab Feature

Inbox tabs and category labels

Gmail just rolled out one of its best features in years: Inbox tabs. (Actually, the feature was announced back in May, but is only just now starting to roll out to users.)
For example, all your notifications from social-media services (Facebook, LinkedIn, Twitter, etc.) will now be sorted into the Social tab, while offers from Groupon, LivingSocial, and other advertisers will land under Promos.
If you're not yet seeing tabs when you sign into Gmail (in your Web browser, natch) or you want to make changes to the settings, do this:

September 24, 2013

How to setup Bloggers improved Crawler and Indexing Feature for SEO purpose.

After blogger updated their interface, they added more useful features such as edit Meta tag modify crawlers and indexing, add authors, etc. This post I'm going to show you how to use blogger new crawlers and indexing feature effectively for improve your blogs SEO.
Before start this guide, I like to briefly explain what robots.txt is. A robots.txt use for provide instructions to different search engine bots to, how to crawl your site contents, etc as well as provide a sitemap. For instance you can remove certain items on search result using this function as well as improve your site SEO.

Important - If you are unsure of any of the steps do not make any edits.

How to create a custom robots.txt on blogger

1) Log-in to your blogger account.
2) Go to your blog.

November 30, 2012

List Category Wise Content Using WP Featured Content Slider

How to Display Category wise content with WP-featured-content-slider?

Well, WP-featured-content-slider is a good way to show small introduction along side a photo with sliding effect but some times we need to list only specific categories content on some specific page so, what to do then?

Its just easy 2 step customization in plugin files, see below.

Step 1:

Kindle Apps