Use Javascript To Get Current URL Page

I have some custom javascript functions that are included on all of my web pages; however, a few functions are only intended for the home page. So I decided to use the “window.location” object to determine if the site URL is in fact the home. See example below:

if(window.location==”http://domain.com/”){
// run home page functions
}

Here are a few other helpful JavaScript objects that expose site locations:

  1. hash: Returns the anchor portion of a URL
  2. host: Returns the hostname and port of a URL
  3. hostname: Returns the hostname of a URL
  4. href: Returns the entire URL
  5. pathname: Returns the path name of a URL
  6. port: Returns the port number the server uses for a URL
  7. protocol: Returns the protocol of a URL
  8. search: Returns the query portion of a URL

Submitting Forms using JQuery and AJAX

Submit A Form Without Page Refresh using jQuery

In this tutorial I’ll show you how easy it is to do just that — submit a contact form that sends an email, without page refresh using jQuery! (The actual email is sent with a php script that processes in the background). Let’s get started.

View Tutorial

Call SOAP-XML Web Services With jQuery Ajax

In order to call the web service, we need to supply an XML message that match the operation definition specified by the web service’s WSDL. With the operation’s schema already in hand, all that is required is to exchange the type names for the operation’s paramaters, with their actual values. The variable soapMessage contains the complete XML message that we’re going to send to the web service.

View Tutorial

Using JQuery, AJAX and JSONP to do cross-domain calls with PHP

The easy part is setting up a PHP page to listen for incoming data and send back a result. Not only will we send back data but we will also send back the function name we want to call on the client’s browser. Here is the PHP code:

View Tutorial

WordPress Custom Post Types and 404 Error Fix

Why use custom post types over regular posts? For starters, it easer to find specific post under particular types on the left admin menu than to drill down under posts then categories. This workflow is ideal for when there are multiple contributors reducing the amount of information needed to communicate changes or add content. Think about handing this off to your client who might not as computer literate as you or your web friends.

Here’s a custom post type by the name “Tech Products”. Add the following code to your “functions.php” file under your theme’s directory:

add_action( 'init', 'create_post_type' );
function create_post_type() {
 register_post_type( 'techproduct',
 array(
 'labels' => array(
 'name' => __( 'Tech Products' ),
 'singular_name' => __( 'Tech Product' )
 ),
 'public' => true,
 'has_archive' => true,
 'capability_type' => 'post',
 'supports' => array('title','editor','author','custom-fields','thumbnail'))
 );
}

Above, you don’t have to define ‘supports’. By default, ‘title’ and ‘editor’ (eg: content) are made available when adding or editing a post type. I felt that only having those two as options made too rigid and sparse.

Once this new code has been posted to your server, you should see the new link on your left admin menu maybe under the “comments” link:

Now let’s add a few more bells and whistles to the mix by defining our post type columns.

add_filter("manage_edit-techproduct_columns", "my_techproduct_columns");
function my_techproduct_columns($columns)
{
 $columns = array("title" => "Product Title", 
"description" => "Description", 
"company" => "Company");
 return $columns;
}
add_action("manage_posts_custom_column", "show_techproduct_column");
function show_techproduct_column($column){
 global $post;
if ("ID" == $column) echo $post->ID;
 elseif ("description" == $column) echo $post->post_content;
 elseif ("company" == $column) echo "Adobe";
}

It should show up like so…

PROBLEM WITH LINKING TO CUSTOM POST TYPES!!!!!

You may run into a problem trying to view your custom post type on your live site using Permalinks receiving a 404 error message. I found a fix by simply navigating over to the Permalinks Settings page. There’s no need to Update or Save changes. I believe by viewing this page, it somehow updates it’s self learning of your new custom post type.

If that does not fix your 404 error message, try removed the %category% from my permalink structure or check if your post type conflicts with a pre-existing category name.

If this does not remedy your issue, there is a long thread over on this post:

http://wordpress.org/support/topic/permalinks-404-with-custom-post-type

Mobile Form using CSS3 and Webkit

Looking for a way to style your mobile website form using round radius corners, colorful gradation backgrounds and placeholder text for text fields.

With the new CSS3 tag attribute, we are now able to target specific types of form tags using the [type=] attribute selector. See image below for the type of form you can create at the following URL: http://37signals.com/…css3-and-webkit

 

Honda Social Media Graphic Chart

Honda Social Media Graphic Chart

Ford Social Media Graphic Chart

Ford Social Media Chart

Upgrade Server Settings Sync Problem with Perallels Plesk

Once I upgraded my server increasing RAM from 500 MB to 1 GB and disk space from 20 GB to 30 GB, my plesk panel was out of sync. I check that my server was upgraded viewing Godaddy’s default control panel and also logging in to my server via SSH from the terminal running df -h to check disk space and free -m to view memory total / usage. The server had been upgraded so now I had to go about fixing the Plesk pannel to refresh. I spent way too much time on the phone with tech support until they pointed me over to their chat service to get in touch with their VDS experts.

Their expert find a refresh button buried in the pannel under the following path:

Tools & Utilities > Server Tools > Services management

I clicked the green arrows labeled refresh on the lop left. That worked so I thought. The home screen now showed accurate info; however the health monitoring was still out of sync. After sufring around on the web, I found a script on my server that needed kick in the rear. Here’s the command I ran in the terminal that forced Plesk into rescanning my server settings:

/usr/local/psa/bin/sw-engine-pleskrun /usr/local/psa/admin/plib/scripts/setup-health-monitor.php

Top 10 useful SSH terminal commands.

Now that you have a virtual server setup, you can enjoy the benefits of managing your server as root (super admin). With root level access, you can send commands to your server using a bash terminal. Here are the common commands:

  • man – stands for manual. Very useful command if you are just getting started with Linux. You can invoke ‘man’, followed by any other Linux command (cd, for example) and it will display detailed description and list of all available options.
  • cd – cd is short for ‘change directory’. Allows browsing between different folders of your VPS.
  • cp, mv, rm – great commands for basic file management. You can copy (cp), move (mv) or remove (rm) files/folders this way from your server.
  • grep – grep permits you to print lines that match a particular pattern. Useful if you are looking for a phrase or or line in a large text file (logs, for example).
  • ls – allows you to list the content of a directory. Using “ls -la” will also show you hidden files/directories (those starting with a dot) and additional attributes, such as permissions and ownership.
  • chown, chmod – every file or directory has its own ownerhip rights – user and group. With “chown” you can modify those parameters and “chmod” gives you the ability to change permissions (read, write, execute) for the owner, group and the rest of the users, accessing that file/directory.
  • nano, vi - “nano” and “vi” are probably the two most popular Linux text editors. You may find “nano” easier to use, while “vi” appears as the preferred editor among more experienced.
  • top, ps – “top” provides you with a periodic update (every five seconds by defaut) of running Linux tasks, while “ps” takes a snapshot of all current processes and prints it on your screen.
  • df -h, du -hs - shows you the current overall use of your disk in gygabytes (df -h).”du -hs” calculates the total size of a directory in a human readable format (e.g., 1K 234M 2G).

Here are two bonus commands for checking DESK SPACE and RAM usages:

To check out the disk space usage on your server, execute this command:
df -h
And to see the memory usage:
free -m

New Back To The Future Nike Shoes

Nike unveils their Back To the Future II self-lacing MAG, Marty MclFly’s sneakers. Leading up to this event, there have been several viral videos on YouTube. Some featuring Michael J. Fox and others feature Christopher Lloyd.

These new kicks are designed to be an exact replica of the original shoe with LED panels and a luminescent Nike logo centered on the strap powered by a rechargeable battery. The lights comes with an on and off switch located on the ear of the high top. Each charge will last five hours.

A limited number of shoes will be put up for auction to raise money for charity. You may be able to purchase a pair on eBay out of the list of 1,500 available.

Read more about it on the following sites:

Add Facebook Comment Box to Your Site

Here is a easy to use script on a web site running PHP. You can also remove the PHP script for reading the current url and replace it with a static address of your current page. Copy and paste the follow under your content:

<iframe src=”http://www.facebook.com/plugins/feedback.php?href=<? echo $_SERVER['HTTP_HOST']; ?>&amp;permalink=0&amp;limit=10″ scrolling=”no” frameborder=”0″ name=”comments4de5a17b0b1299724858306″ class=”comments” width=”680px” height=”150px”></iframe>

If you need help with adding a fb friendly URL to your code, use this tool on facebook to generate your code:

http://developers.facebook.com/tools/lint

Page 1 of 20123451020Last »