“Go Back” Button


Browsers already have “back” buttons, so you’d better have a darn good reason for needing to put one on your page!

Input button with inline JavaScript

<input type="button" value="Go Back From Whence You Came!" onclick="history.back(-1)" />

This is totally obtrusive, but you could fix that by only appending this button through JavaScript.

PHP

If JavaScript isn’t a possibility, you could use the HTTP_REFERER, sanitize it, and echo it out via PHP.

<?php
  $url = htmlspecialchars($_SERVER['HTTP_REFERER']);
  echo "<a href='$url'>back</a>"; 
?>
Advertisements

404 error in accessing child theme in wordpress multisite


If you are using IIS Server and need to install wordpress multisite. Click here for the installation process.

After installing the multisite when you create a child theme, there might be a problem you are getting 404 error. It means the path you are trying to access on your web browser is not able to redirect to the specified directory. It is the problem for redirection. In this case just update your web.config if you are using the Windows IIS Server or update the .htaccess file if you are using the apache/linux Server.

Code for web.config file:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="WordPress Rule 1" stopProcessing="true">
                    <match url="^index\.php$" ignoreCase="false" />
                    <action type="None" />
                </rule>
                <rule name="WordPress Rule 2" stopProcessing="true">
                    <match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" />
                    <action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" />
                </rule> Continue reading 

CSS nowrap Alternative


To achieve the same results as a TD nowrap (<td nowrap=”true”>) using cascading style sheets, use the following:

white-space: nowrap;

This style attribute only applies at the TD element level ie needs to be applied to each TD, ie not the the TR or TBODY.  If you’re desparate to not apply it to each TD,  then you can get away with only applying it to the TD’s of the first row – but this is only effective if applied to the cells containing thelongest data (so IMHO is a half-baked approach – ie don’t do it).

Floating Header: Scroll Effect using HTML,CSS,JQuery


Ever scrolled halfway down the page – and then the navbar at the top appears? This can be very useful and looks professional. This tutorial will introduce a very basic approach how to get this happening.

1. Download the basic ‘Bootstrap’  Pre-Config from ( BootStrap ) .

Now update the index.html with the following:

<!DOCTYPE HTML>

<html>

<head>

<link rel="stylesheet" href="css/bootstrap.css">

<script type="text/javascript" src="js/vendor/jquery-1.9.1.min.js"></script>

<script type="text/javascript" src="js/vendor/bootstrap.min.js"></script>

<style type="text/css">

body {

padding-top: 60px;
 Continue reading 

Adding multiple backgound images to same element


To add multiple background in the same element just add the images like this:

div.test {
	background-image: url(17072011167.jpg), url(25022010220.jpg);
	background-repeat: repeat;
	background-position: top left, top right;
	height: 768px;
	border: 1px solid #000000;
}

just replace div.test with #test and add div with id test and you are all done !!

PNG fix for IE6 in wordpress


Add the following code in the <head> tag

<?php
header('Content-type: text/x-component');
?>
<style type="text/css">

/*
USAGE:
Copy and paste this one line into your site's CSS stylesheet.
Add comma-separated CSS selectors / element names that have transparent PNGs.
Remember that the path is RELATIVE TO THIS HTML FILE, not the CSS file.
See below for another method of activating the script without adding CSS here.
*/

img, div, input { behavior: url("http://<domain name>/wp-content/themes/<theme name>/iepngfix.htc") }
/*
Here's an example you might use in practice:
img, div.menu, .pngfix, input { behavior: url("/css/iepngfix.htc") }blank
*/

</style>

and download the files

iepngfix.doc

blank.gif

rename the iepngfix.doc to iepngfix.htc and put it on the root of your theme folder.

Generate Random Number in PHP


function refrence_id()
{
    $refrence_id = 'DD'.mt_rand(100000, 999999);
    // check if number already exists in database
    $ref = mysql_query("select count(*) from registration where refrence_id='".$refrence_id."'");
    $refer_no = mysql_fetch_array($ref);
    if($refer_no[0] > 0)
    {
        refrence_id();
    }
    return $refrence_id;
}

$tmpRefID = refrence_id();