09 Feb 2014
Customize the WordPress Search
We can change the design and add additional fundability in the search widget provided by WordPress. Make a file “searchform.php“ in your theme folder and add the blow given code. You can also add your style or script as need in this file. <?php /** * The template for displaying Search Results pages * * […]
08 Feb 2014
Filter Search In WordPress
We can filter our search in WordPress according to posts or custom post. Like I have two custom posts type videos and news and I want WordPress search page will display records out of only these 2 custom posts whenever user search record. So to achieve this we have to write this code in our […]
08 Feb 2014
Disable Updates in WordPress
To disable the update in WordPress Write these lines in functions.php of your theme folder. To Disable Theme Updates # 3.0+ remove_action( ‘load-update-core.php’, ‘wp_update_themes’ ); add_filter( ‘pre_site_transient_update_themes’, create_function( ‘$a’, “return null;” ) ); wp_clear_scheduled_hook( ‘wp_update_themes’ );
02 Feb 2014
document.getElementsByName
getElementsByName() is a method in JavaScript through which we can accesses all elements with the specified name. Example : <html> <head> <script type=”text/javascript”> function getbyNameDemo(){ var sub = document.getElementsByName(‘rbtnSubjects’);
01 Feb 2014
Textbox in CakePHP
Following are the methods through which we can create Textbox in CakePHP. Example 1: echo $this->Form->input(‘usrUsername’); Above code will render following output in view: <div class=”input text”> <label for=”UserUsrUsername”>Usr Username</label><input name=”data[User][usrUsername]” type=”text” id=”UserUsrUsername”/> </div>
30 Jan 2014
Custom Post in WordPress
In below example I have added 2 custom posts in WordPress (with different parameters) Videos News Add the following code in functions.php and it will create menu in admin panel for videos and news. add_action( ‘init’, ‘create_post_type’ ); function create_post_type() { register_post_type( ‘my_video’, array( ‘labels’ => array( ‘name’ => __( ‘Videos’ ), ‘singular_name’ => __( […]
26 Jan 2014
Create a Form in CakePHP
To create a form in CakePHP we can use careate() method. Let’s take an example with cake1 as a root folder and users is a table. <?php echo $this->Form->create(); ?> Above code will render following output in view: <form action=”/cake1/users/” id=”UserIndexForm” method=”post” accept-charset=”utf-8″> In create function parameters are optional. If we call this function without […]
19 Jan 2014
document.getElementById
getElementById is a function in JavaScript to access the HTML elements. It’s a function of document object and can only access by using document.getElementById. Example : <html> <script> function sum() { var num1 = document.getElementById(‘num1’); var num2 = document.getElementById(‘num2’); var res = document.getElementById(‘result’); res.value = parseInt(num1.value) + parseInt(num2.value); } </script> <body> Enter First Number : […]
18 Jan 2014
The Global Keyword
A global variable can be accessed in any part of the program. In php global keyword is used to access a global variable. Global keyword has to use before the variables (inside the function). Global variables are stored in an array called $GLOBALS[index]. Index holds the name of variable and this array can directly access […]
25 Dec 2013
Array in JavaScript
Array is use to store multiple values in a one variable. Example 1: <script> var a = new Array(); a[0] = 2; alert(a[0]); </script> Example 2: <script> var b = new Array(78,4,5,3,5,7); for(i=0; i < b.length; i++) { alert(b[i]); } </script> Example 3: <script type=”text/javascript”> var ar = new Array(“Ram”,”Deep”,”Ravi”,”Mohit”); for (i=0; i