Jquery get all checkboxes

You can get all elements by name var $n = jQuery.noConflict(); //Jquery no conflict $n(“#btnsubmit”).click(function() { var allChkbox=$n(‘input[name=chkarr[]]’); jQuery.each(allChkbox, function(i, singlecheckbox) { alert(singlecheckbox.value+” is “+ singlecheckbox.checked); }); });

Read more

wordpress custom page

custom page is wordpress standalone page which is not use as wordpress page or page.there is some situation where you need custom page which will define owns html and js and othere elements using wordpress header and footer.This is very easy in wordpress to create cusom page.This wordpress custom page will depends on theme you are using.So some of customization

Read more

wordpress logout user

example <div ><a href=”<?php echo wp_logout_url( ); ?>” title=”Logout”>Logout</a></div> How to logout user using another way ? If you want to logout user own way then you can do using following code <?php require_once(‘wp-blog-header.php’);  // this is root file so adjust your pah accordingly   wp_clear_auth_cookie();  //this will logout user ?>  

Read more

wordpress physical installation path

Simply you can get wordpress physical installation path using ABSPATH Constant. require_once(‘wp-config.php’); echo ABSPATH;

Read more

wordpress how to check is post or page

How to check if the current request is for the post  ?   You can check if the current request is for for post using wordpress function is_singel(). Example is_single( ’17’ ) When Post 17 is being displayed as a single Post. is_single( ‘Irish Stew’ ) When the Post with Title “Irish Stew” is being displayed as a single Post.

Read more

wordpress get random post

You can get current wordpress category get_the_category function. Random Post Code <?php global $post; $categories = get_the_category($post->ID); $catId=$categories[0]->term_id;//wordpress current category ?> <ul> <?php $args = array( ‘numberposts’ => 5, ‘orderby’ => ‘rand’ ,’category’ =>$catId); $rand_posts = get_posts( $args ); foreach( $rand_posts as $post ) : ?> <li><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></li> <?php endforeach; ?> </ul>  

Read more

IIF in php

There is ternary operator(conditional) operator in php which is used for IIF equivalent condition in php. The conditional operator is the “?:” (or ternary) operator. The expression (expr1) ? (expr2) : (expr3) evaluates to expr2 if expr1 evaluates to TRUE, and expr3 if expr1 evaluates to FALSE. Since PHP 5.3, it is possible to leave out the middle part of

Read more

jquery synchronous AJAX request

How to make synchronous ajax request using jquery Bydefault jquery ajax request is asynchronouse means execution of next code is continue whether or not your ajax request is complete or not. Create synchronous ajax request: For creating sync request you can use property async as false Cross-domain requests anddataType: “jsonp” requests do not support synchronous operation. Note that synchronous requests

Read more

get querystring using jquery

You can easily get query string values using jquery. Code $.urlParam = function(name){ var results = new RegExp(‘[\\?&]’ + name + ‘=([^&#]*)’).exec(window.location.href); if (!results) { return 0; } return results[1] || 0; } var yourQstring = $.urlParam(‘querystringname’); //$.urlParam() is array of query string

Read more
1 4 5 6 7