Posts

Showing posts from July, 2015

Geolocation in web browsers to find location & Google Maps Route examples

Image
More and more services around us focus on where we physically are located at the moment, and how we can be assisted in the best fashion depending on that. Today I’d like to introduce the geolocation possibilities we developers have, and also play around a little with Google maps. Introducing geolocation Geolocation, i.e. finding out where someone is located, is extremely simple for a web developer. This is the code to accomplish that: 1. // Check for geolocation support 2. if (navigator.geolocation) { 3. // Use method getCurrentPosition to get coordinates 4. navigator.geolocation.getCurrentPosition( function (position) { 5. // Access them accordingly 6. alert(position.coords.latitude + ", " + position.coords.longitude); 7. }); 8. } That’s it! Pretty simple, right? What happens when you utilize this code is that the web browser will show a notification to the end user, ask them if they want to share their location or not, and offer them

moving wordpress site from server to localhost redirecting to server homepage

Check that the siteurl and home fields in the wp-options table have the new, local value, i.e. http://localhost/new-domain Try this, change your permalinks settings back to the default, save, you will see that your links are now working. You can then change back to post name or whatever your were using before.

How to add Login/Logout Menu Link to wordpress menu

Image
Almost nothing is more frustrating for a user than searching around for a login link in order to get to important content. The following method  right on your menu bar . will automatically detect whether a user is logged in or not and put a login or a logout link *** Please note, this method only works when you are using  WordPress’ custom menus . (The menu function available in the admin section: Appearance > Menus.) Add Code to Your Functions File You will need to add a bit of code to your functions file for this. But after copying and pasting this code, you’re finished. Go to Appearance > Editor > Theme Functions (functions.php). Place the following code in the bottom your functions file and hit “Update File.” add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2); function add_login_logout_link($items, $args) {         ob_start();         wp_loginout('index.php');         $loginoutlink = ob_get_contents();         ob_end_cle