Skip to content

Instantly share code, notes, and snippets.

@deepak-rajpal
deepak-rajpal / Tabs-Using-JavaScript.html
Last active December 15, 2015 03:39
Tabs using javascript function, no need of jquery
<!-- Archived TutorialClass.com - http://tutorialsclass.com/articles/tools-technology/javascript-tabs-without-jquery -->
<html>
<head>
<script type="text/javascript">
function showtab(tabs)
{
/* alert("entered to function"); */
var tab=tabs;
switch(tab) //this switch case replaces the tabContent
{
@deepak-rajpal
deepak-rajpal / Tabs-Using-Jquery.html
Created March 19, 2013 13:17
Tabs using jquery. Using <li>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>jQuery Tabs </title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
<style>
#tabs ul { padding-left:0px; }
#tabs ul li { display:inline-block; border:1px solid;}
</style>
@deepak-rajpal
deepak-rajpal / Tabs-Using-Jquery.html
Created March 19, 2013 13:19
Jquery Tabs using <td> as Tabs.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>jQuery Tabs</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#tabs p').hide();
$('#tabs p:first').show();
@deepak-rajpal
deepak-rajpal / data.json.php
Last active December 15, 2015 03:39
WordPress jquery timeline implementation Shortcode example (Using http://tutorialzine.com/2012/04/timeline-portfolio/ timeline code to output). Passing one attribute.
<?php session_start();
// load WordPress environment
include_once('../../../wp-load.php');
header("Pragma: no-cache");
header('Content-type: application/json');
?>
{
"timeline":
<?php
/* $cat = $_REQUEST["cat"]; // better to use from session instead of url request */
@deepak-rajpal
deepak-rajpal / restrict-wordpress-admin-by-ip-address.php
Created April 18, 2013 09:25
Restrict Wordpress Admin/Login/Access by IP Address (Example for Localhost): Add following code into .htaccess file
<Files wp-login.php>
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Files>
@deepak-rajpal
deepak-rajpal / ie-opacity-jquery-support-issue.js
Created April 24, 2013 13:47
In IE Mouse hover fading (such as in menu) not supported because of opacity support not available. Solution: Using css rather than animate, just change color that seems to faded color: But disadvantage is that if there are two color in menu, both will change to same color. so this alternative not completly good.
// Following mouse hover fading not supported in ie because of opacity
jQuery('div#navwrap ul.nav li a').hover(function() {
jQuery(this).animate({opacity: .4}, "fast");
}, function() {
jQuery(this).animate({opacity: 1}, "fast");
});
// Solution: Using css rather than animate, just change color that seems to faded color:
jQuery('div#navwrap ul.nav li a').hover(function() {
@deepak-rajpal
deepak-rajpal / jquery-last-css-selector-example.js
Created April 24, 2013 13:52
Change last menu item color by jquery selector
$("#navwrap ul.nav li:hover a:last").css("color", "#ffffff");
@deepak-rajpal
deepak-rajpal / wordpress-default-jquery-deregister-update.php
Last active December 17, 2015 01:49
If default wp_head cause including old JQuery version such as 1.4.2. Add following into function.php to De-register current default JQuery and include new one (version 1.7.2) in this case.
<?php
// code to include in theme's functions.php
if( !is_admin()){
wp_deregister_script('jquery');
wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"), false, '1.7.1');
wp_enqueue_script('jquery');
}
?>
@deepak-rajpal
deepak-rajpal / wordpress-only-parent-page-highlight.css
Created May 7, 2013 10:27
Issue: WordPress Menu Child are also highlighted if current page is parent. WordPress Menu's submenu highlight selection issue:
/* Highlight/underline only direct anchor of class current_page_item */
#nav1 li.current_page_item>a { text-decoration:underline; }
@deepak-rajpal
deepak-rajpal / wordpress-display-query-variables.php
Created May 7, 2013 10:41
WordPress display all wp_query and query variables (post information etc)
<?php
global $wp_query;
echo "<pre>";
var_dump($wp_query->query_vars);
var_dump($wp_query);
echo "</pre>";
?>