Code Food Travel repeat!

Customize WordPress Google Maps Store Locator Plugin: WPSL

This is a post of all the awesome mods I was able to do on WP Store Locator to have it work the way I wanted, mainly:

  • Remove the search bar
  • Display results as a grid row (responsively designed)
  • Customize the store info attributes.. showing phone and hours natively
  • Disabling Scrollwheel (so when you’re scrolling down the page, it doesn’t start zooming into the map
  • Disabling Dragging on mobile devices (so when you’re touch scrolling you don’t get stuck in quicksand land on panning around the map and you can’t leave that section of the screen)

 

Hands down, this is the cleanest of them all and not filled with complicated garbage. I went through ALL the rest of the popular ones and their request for you to upgrade to get ‘premium features’ at $750+ was driving me mad.

Thank gosh I found this one. The MAIN issue with the others is that it wouldn’t let you specify your start location – it would put an ugly ass “home” icon in the middle of the US, and that would horribly zoom out your map to accommodate for that marker unless you wanted to pay hundreds of dollars to get rid of it.

Luckily WPSL lets you specify your starting home location for the map view! I set mine as one of the stores I’m displaying.. just so it can display nice and close.

Next benefit of WPSL is that you can easily mod the javascript with little to know JS knowledge! (aka me) to have it display what you want.

Removing the search bar & Displaying the results as rows of 4 (works for responsive layouts too!)
(CSS MODS)

/* * * LOCATION MODS * * */
#wpsl-result-list li {

	width: 23%;
	min-width: 180px;
	float: left;
	margin-right: 20px;
}

.wpsl-search {display:none;}

Customizing the Store Listing results to natively display the PHONE # and HOURS without having to click on the marker to load the info window
(JS MODS)

This was line 813 in the file wpsl-gmap.js
Also note: I took out distance and directions (because i set my starting marker at one of the stores.. so it would just display 0 miles away and give false directions).

		/* * * * *CUSTOM STEVEN CHU * * * * */
		html = "</pre>
<ul>
	<li data-store-id="&quot; + id + &quot;">
<div>
" + storeImg + "<strong>" + store + "</strong><span class="wpsl-street">" + street + "</span>"  + city + " " + state + " " + zip + "

" + moreInfo + "</div>
<span class="store-phone">" + response.phone + "</span>

<span class="store-hours">" + response.hours + "</span></li>
</ul>
<pre>
";

Disabling Scrollwheel Zooming on computers & Disabling Dragging on mobile devices

Thanks to this amazing snippet by Kenny Brijs, I found the corresponding sections in the plugin to modify.

BASE CODE:

function initMap(){
	var isDraggable = $(document).width() > 480 ? true : false; //If site is wider than 480px, isDraggable = true, else false.
	var mapOptions = {
		draggable: isDraggable,
		scrollwheel: false, //Prevent users to start zooming the map when scrolling down page
	};
}

How to modify in WPSL Store Locator: Find wpsl-gmap.js and search CNTL+F / CMD+F for myOptions.
On my version of WPSL (1.2.13), it is line 67

Just above myOptions array, I pasted the variable isDraggable if screen is above 480px.
Then in the options, I added in the draggable option (to our isDraggable specifications) and scrollwheel set to false – Both of these options WPSL does not have by default!

My final code that I replaced in the plugin file on my live website is:

/* * * CUSTOM STEVEN CHU * * */
	var isDraggable = $(document).width() > 480 ? true : false; //If site is wider than 480px, isDraggable = true, else false.


    myOptions = {
		zoom: zoomLevel,
		center: startLatLng,
		mapTypeId: mapType,
		mapTypeControl: false,
		panControl: false,
		streetViewControl: streetViewVisible,
		draggable: isDraggable,
		scrollwheel: false, //Prevent users to start zooming the map when scrolling down page
			zoomControlOptions: {
				style: zoomControlStyle,
				position: zoomControlPosition
			}
	};

How to display image slides / slider in Redux Framework on WordPress

I like Redux Framework (formerly NHP Options) for easily building an interface for theme customization options, however I think they are super mean in providing no documentation (and no very clear documentation) on displaying / rendering the values on your webpage. It’s great that they are all experts in PHP codes and arrays, but not all of us are… so why keep it elitist when these questions are being asked multiple times already in their support forums.

Anyhow, it comes with a neato image slider option – so you can make like an intro slideshow for your website pretty easily. I combined the slider with Fotorama.io (my image gallery of choice).

By default your options are called $redux_demo, but i changed mine for a client site i’m working on so mine is called spafiesta_options. In the Redux Framework plugin folder, there’s a sample_config.php file which you can customize. Do a search for the ‘slides’ section, and you’ll find by default the ID for that feature is called ‘slides’.

Below, I’m saying for each slide in the ‘slides’, to display it inside an img tag. Wrap it in your image gallery of choice, and voila! done!

			<!-- Fotorama -->
			<div class="fotorama" data-width="100%" data-fit="cover" data-autoplay="5000" data-height="400" data-max-width="100%" data-ratio="500/333" data-trackpad="false">
				
				<?php  global $spafiesta_options;
				foreach($spafiesta_options['slides'] as $slide) {
				  echo '<img src="' . $slide['image'] . '">'; 
				}
				 ?>
		
			</div>

 

(Hint for the solution after 1 hr of looking was here: https://github.com/ReduxFramework/redux-framework/issues/352)

How to Load & Use Photoshop Actions to Automate Photo Resizing

I’m currently writing an email to a client to explain how to use the photoshop action I just created for him, to automate resizing custom thumbnails for his website where they’ll all be the same size on a white background no matter vertical or portrait. And figured, we can all use this tutorial, so here it is!

This is an automated action I created for you to BULK automate resizing of your photos.

  1. Download the file and move it into your actions folder: Photoshop > Presets > Actions
  2. Open photoshop, open your Actions panel. In photoshop, go to Window > Actions. Then on the upper right corner of actions panel, click the options button (looks like down arrow + list symbol “=”) go to Load Actions. Load it!
  3. Then you want to select the option titled “thumbnail sizer” and manually click play (triangle) for each image and it will take care of everything and save a copy on your desktop.
  4. Or to do bulk images of folders in actions, I need to modify the last step and not have it close the file out.

The Beauty of Conditional Photoshop Actions

Now it is possible to run conditional Photoshop Actions as batches, too. Instead of having to run a separate batch for portrait and landscape images, they can all be dumped into a folder and resized via a Photoshop Batch. To run a batch, go to “File” > “Automate” > “Batch.”

Photoshop Actions Batch

Choose the set that your Action belongs to and choose the conditional Photoshop Action that you just created. Choose the source folder where your collection of images are located. Then, choose a destination folder for your processed files to go into. I usually just create a folder inside of the original folder called “processed.” At the bottom, it says “stop for errors”. When I ran this batch, I kept getting a message that the if condition wasn’t available, but it still ran the batch anyway. I just had to click the button telling it to proceed. If you want to avoid this, tell Photoshop to log errors to a file. If you do this, the files that had errors will have to be saved manually to the destination folder. To me, it is much less of a headache to hit Enter/Return a few times than to have to manually save multiple images.

Conclusion

Photoshop Actions are an incredible tool for creating time-saving shortcuts for repetitive tasks. If you have a repetitive task that takes multiple steps, it is easy to just record it once and then have it available as a hotkey. If you have a folder full of images you can run a batch, taking a half an hour of manual work and tuning it into just a minute or two of work can save you tremendous amounts of time in the long term. With the addition of conditional Photoshop Actions, we can now save even more time by telling Photoshop to look for certain parameters. There are other conditions besides the landscape format, such as being square, RGB, being an unsaved document, and more.

Convincing Email Scam: Mugged in the Philippines & Need Money

Convincing Email Scam: Mugged in the Philippines & Need Money

I received a pretty convincing email today from a longtime friend who almost never emails me, which said he was in Manila, Philippines – was mugged and needed money sent over. FAKE!

It looked completely real from my iPhone and I freaked out. THANKS FOR NOTHING APPLE.
A friend with me convinced me that it was not a good time to randomly send money to the Philippines given the recent typhoon disaster.

I later rechecked the email from my computer, and THANK THE LORD FOR GMAIL and it’s ACE A++++ spam / phishing detection filter.
It looks much less real given how Google formats emails.

Google’s warning read:

“Be careful with this message. It contains content that’s typically used to steal users personal information.
Learn more / Report this suspicious message / Ignore, I trust this message”

The email subject reads: “Sad News…… ____INSERT SENDER NAME____”  <- at first i was startled because it sounded like a funeral

The email body reads:

Hello,

This message may be coming to you as a surprise but I need your help.Few days back we made an unannounced vacation trip to Manila Philippines.Everything was going fine until last night when we were mugged on our way back to the hotel.They Stole all our cash,credit cards and cellphone but thank God we still have our lives and passport.Another shocking is that the hotel manager has been unhelpful to us for reasons i don’t know. I’m writing you from a local library cybercafe..I’ve reported to the police and after writing down some statements that’s the last i had from them.i contacted the consulate and all i keep hearing is they will get back to me. i need your help ..I need you to help me out with a loan to settle my bills here so we can get back home, our return flight leaves soon. I’ll refund the money as soon as i get back. All i need is $1,950 ..Let me know if you can get me the money then I tell you how to get it to me.

I’m freaked out at the moment

Regards.
___INSERT SENDER’S NAME____

 

The reply to address has a carefully constructed address that looks like the owner’s original address. In this case, they added on 2 more numbers but kept the rest basically the same.

According to this blog, first they hack the user’s email, then their facebook to gather their locational data to use – so they sound convincing and factual to their friends. Gross!

 

Few days back we made an unannounced vacation trip to Manila Philippines.Everything was going fine until last night when we were mugged on our way back to the hotel
Few days back we made an unannounced vacation trip to Manila Philippines.Everything was going fine until last night when we were mugged on our way back to the hotel

5 of 27
123456789
%d bloggers like this: