Posts

Showing posts from 2013

How to make index.html default instead of index.php?

How to make index.html default instead of index.php?   Put a .htaccess file in your web root directory, if there isn't one yet. Then add the line: DirectoryIndex index.html index.htm index.php or change it accordingly. That line tells apache what file to look at first when it is not specified in the URL, in the same order that you put it after DirectoryIndex. In this example it would first look for index.html, load it if found, if not look for index.htm, load it if found, and if not load index.php. 

How to call a function on mouse scroll wheel via jquery?

How to call a function on mouse scroll wheel via jquery? Simple copy and paste this code and follow the steps. <script> function handle(delta) {         if (delta < 0)         {         functionscrolldown(); // You can change here the function event according to your need on mouse wheel down         }         else         {         functionscrollup(); // You can change here the function event according to your need on mouse wheel up         } }  /** Event handler for mouse wheel event.  */  /* here mouse wheel event stop from the browser */ $(document).on("click", '.fancybox-close', function(e) { // you also need to stop the Mouse wheel function event on a certain evernt of mouse click so you need to change the ".fancybox-close" class accoding to your click button window.removeEventListener('DOMMouseScroll', wheel, false); window.removeEventListener('mousewheel', wheel, false); });  /* here mouse wheel event will start for the

How to Install Cakephp?

Image
On Cakephp Welcome Screen, you will fine two error. To remove this error, you must be change 01. Security . salt value. 02. Security . cipherSeed value.     Please Change Security.salt value: 1. Open this project in php text editor. 2. Go to app/config/core.php file 3. In line no 204 change Security . salt value. // you can change this value whatever you want 4. Then refresh the startup screen. Our 1 st error has been removed. »Change Security.cipherSeed value: 1. Open this project in php text editor 2. Go to app/config/core.php file 3. In line no 208 change Security . cipherSeed value. // you can change this value whatever you want but only in digits Then at the end of page you will find database error so for remove this error you need to edit the page 1. Open this project in php text editor 2. Go to app/config/database.php.default file and rename (remove .default ) this file. 3. Rename file will be like this database.php 4. Then refresh the startup screen.

is_home() and is_front_page() not working in wordpress?

I want to same content on home page but is_home() and is_front_page() not working in wordpress. Why? Then i search some sites and find a solution. Here is the solution:- Just add this like right before of your condition <?php wp_reset_query(); ?> <?php if(!is_home()){         echo "home page"; <?php } else { echo "Not home page"; } Thanks

How to add One Page template in Twenty thirteen theme wordpress?

Add One Page template in Twenty thirteen theme wordpress. Here i will tell you that how to create one page template in twenty thirteen theme Step 1: create a folder inside theme folder themes/twentythirteen/ Like : themes/twentythirteen/ page-templates Step 2:  Create a file named one-page.php inside page-templates folder Step 3 : Copy and paste this code in your one-page.php page <?php /**  * Template Name: One Page  *  * Author Olivia Hoback  * www.olivia.nu  * @package WordPress  * @subpackage Twenty_Thirteen  * @since Twenty Thirteen 1.0  */ get_header(); ?> <div id="primary" class="content-area">         <div id="content" class="site-content" role="main"> <?php while ( have_posts() ) : the_post(); ?> <div class="col-lg-12 inner">                     <?php if ( has_post_thumbnail() && ! post_password_required() ) : ?>                     <div cl

How to get top parent page ID in wordpress?

How to get top parent page ID in wordpress The solution to get the top parent page id is here, it is quite easy. function wp_get_top_parent_page_id() {     global $post;     // Check if page is a child page     if ($post->ancestors) {     //  Grab the ID of top-level page from the tree     return end($post->ancestors);     } else {     // Page is the top level, so use  it’s own id     //return $post->ID;     return 1;     }     } echo wp_get_top_parent_page_id();

How to get the post link in WordPress?

How to get the post link in WordPress? <?=get_permalink(12)?> Where 12 is the id of your post.

How to display post from a category in wordpress?

How to display post from a category in wordpress?  Simply copy and paste the code in your php file and change the category id which one you want to show. <h4>Latest Post</h4>           <ul class="list-blog">  <?php             query_posts(array('category__in' => array(4),'posts_per_page' => 4));             while(have_posts()) { the_post();             ?>             <li>             <?php             $post_thumbnail_id = get_post_thumbnail_id($post->ID);                        $post_thumbnail_url = wp_get_attachment_url( $post_thumbnail_id );             if($post_thumbnail_url!='')             {                 $post_thumbnail_url = $post_thumbnail_url;             }else             {                 $post_thumbnail_url = get_template_directory_uri().'/img/noimg.jpg';             }             ?>              <img width="60" height="60" alt="" class="

How to open a menu links in new tab in WordPress?

Image
How to open a menu links in new tab in WordPress? In the menu tab, pull down the screen Option tab and select the Link Target attribute so you can add that. and checked Open link in new tab. WordPress

How to get home page link in WordPress when it is in subfolder?

How to get home page link in WordPress when it is in subfolder? Like localhost/WordPress/ Or www.site.com/WordPress/?p=1 <?php echo get_option('home'); ?> Try this :)

How to get the template Theme url in WordPress?

How to get the template Theme url in WordPress? <?php echo get_template_directory_uri(); ?>

How to Get category id for category.php page?

How to Get category id for category.php page? or How to Get category id for category page? <?php echo $cur_cat_id = get_cat_id( single_cat_title("",false) ); ?> Hope this will help you... :)

How to display in WordPress Category, Category post, Subcategory, Subcategory post?

Image
How to display in WordPress Category, Category post, Subcategory, Subcategory post? First you need to click on image and check how will result show on your page. And is this useful to you simple Copy and paste this code on your index page or where ever you want to show. Only you need to change the categories id in the array Hope this will help you <?php                             $row = 0; // Here you can pass the id of your category which you want to show                             $arrayid = array('0'=>9,'1'=>10,'2'=>7,'3'=>8,'4'=>11,'5'=>12);                             foreach($arrayid as $aid)                             {                             if($row%3==0){ ?> <div class="row-fluid"> <?php }                             ?>                                 <div class="span4 box-featured">                                     <div class=

How to get the page link in WordPress?

How to get the page link in WordPress? You can add simply this code to get page link only you have to pass the page id <?php echo get_page_link(30); ?>

How to get the category page link in WordPress?

How to get the category page link in WordPress? You can add simply this code to get category page link only you have to pass the category id <?php echo get_category_link($category->term_id);?>

Got a packet bigger than 'max_allowed_packet' bytes error in mysql?

Image
 Got a packet bigger than 'max_allowed_packet' bytes error in mysql? Open your my.ini and search max_allowed_packet   and change it to max_allowed_packet = 20 M

Uploadify with IE (Internet Explorer) destroy the session or reset the session in Codeigniter.

I was totally Fed up with this that why session destroyed every time when i upload a file in IE browser. I was using codeigniter and on a form i use uploadify, When i upload a photo and click on submit it take me on login page when i was login what is the problem with that. So Finally i solved this problem, Please take a look Open app/config/config.php In your config.php you can set your $config['sess_match_useragent']= FALSE;  When doing this CI 2.0 atleast, won’t create a new session for the flash object, and thus not kill your current session in IE.

How to checked all checkbox by on click on one checkbox via jquery?

How to checked all checkbox by on click on one checkbox via jquery? download jquery file from http://jquery.com/ and save into your folder. Note: Do not give online path of on your file otherwise this code will not work,  download jquery file form server and save it in your folder Now simple copy and paste this code in your file <script src="yourSiteUrl/js/jquery.min.js"></script> // Change this yourSiteUrl from your site url <script> function markall() { var AllDay = $("#select_all").is(":checked") ? "true" : "false";     if(AllDay=='true')     {         $('.clsNoborder').attr('checked',true);     } else {         $('.clsNoborder').attr('checked',false);     } }; </script> <div> <input type="checkbox" id="select_all" name="select_all" onclick="markall();"/>: check all </div> <div>  <input typ

How to check that date is today and yesterday in php?

How to check that date is today and yesterday in php? Use this function for get today and yesterday function get_day_name ( $ time ) { $date = date('d/m/Y', $time);             if($date == date('d/m/Y')) {             $time_since = 'Today';             } else if($date == date('d/m/Y',now() - (24 * 60 * 60))) {             $time_since = 'Yesterday';             }else             {             $time_since = 'Today';             } return $time_since; }        

Force Redirect http:// to https:// in codeigniter by .htaccess

Force Redirect http:// to https:// in codeigniter by .htaccess simply copy and paste this code in htaccess of root  to redirect http:// to https:// # Enforce SSL https://www. RewriteCond %{HTTPS} !=on RewriteRule ^.*$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Simple html css tooltip.

Simple html css tooltip. this is html css tooltip which is faster than jquery or javascript tooltip simple code and paste this code in file and hover on link <!-- css code --> <style>   .tooltip { border-bottom: 1px dotted #000000; color: #000000; outline: none; cursor: pointer; text-decoration: none; position: relative; } .tooltip span { position: absolute; display:none; } .tooltip:hover span { border-radius: 5px 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.1); -webkit-box-shadow: 5px 5px rgba(0, 0, 0, 0.1); -moz-box-shadow: 5px 5px rgba(0, 0, 0, 0.1); font-family: Calibri, Tahoma, Geneva, sans-serif; position: absolute; left: 1em; top: 2em; z-index: 99; margin-left: 0; width: 250px; display:block; } .tooltip:hover img { border: 0; margin: -10px 0 0 -55px; float: left; position: absolute; display:block; } .toolt

Define DDL and DML in my mysql?

Define DDL, DML commands DDL Data Definition Language (DDL) statements are used to define the database structure or schema. examples are: CREATE - to create objects in the database ALTER - alters the structure of the database DROP - delete objects from the database TRUNCATE - remove all records from a table, including all spaces allocated for the records are removed COMMENT - add comments to the data dictionary RENAME - rename an object DML Data Manipulation Language (DML) statements are used for managing data within schema objects. examples are: SELECT - retrieve data from the a database INSERT - insert data into a table UPDATE - updates existing data within a table DELETE - deletes all records from a table, the space for the records remain MERGE - UPSERT operation (insert or update) CALL - call a PL/SQL or Java subprogram EXPLAIN PLAN - explain access path to data LOCK TABLE - control concurrency

How to create custom 404 redirect in codeigniter?

How to create custom 404 redirect in codeigniter? there are lots of post on website which told you about custom 404 redirect in codeigniter but most of them are worth less. Give a minute on this post and you will see this blog give exact what you want. Step first: Create a file in your controller errors.php and paste this code in this file <?php class Errors extends Controller { function Errors() { parent::Controller(); } function error_404() { $this->load->view('error_404'); } } ?> Step Two:  Create a file in your View folder name as error_404.php and write you error msg in this page Step Three: Now opne this file   yoursite/system/core/ Common.php and search this function  show_404() Please note: in many version common.php file in another folder so you can search for this file on this root also  yoursite/core/codeigniter/Common.php A nd replace this code with this function function show_404($page = '') { he

How to submit a form via curl in php?

How to submit a form by curl Lets take and example this is your submit form <form action="website.com/signup" method="post"> <input type="text" name="email" /> <input type="submit" name="submit" value="Submit" /> </form> and you want to submit this form by curl So, Simple copy and paste this in you php file and change field name and form action url and run the file This code will help you submit a form via curl <?php $fields_string =''; $url = 'website.com/signup'; $fields = array( 'EMAIL' => $_POST['email'] ); //url-ify the data for the POST foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } rtrim($fields_string, '&'); //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch,CURLOPT_URL

Why my bootstrap css is not working on mobiles?

Bootstrap css is not working on mobiles when all is fine in your  Bootstrap  html code. and when you open your site on mobile then it shows as  it shows onn your pc. and you still you are frustrate that why  Bootstrap css  is not working. so please check your meta tag did you add this code in of head tag of html <meta name="viewport" content="width=device-width, initial-scale=1.0" />  most of the people when create Bootstrap css the forgot to add this on head tag in html thats why this css not working on mobiles browser so add this code in head tag of html code  <meta name="viewport" content="width=device-width, initial-scale=1.0" />

How to compare two dates via javascript?

How to compare two dates via java-script or how to check two dates that which one is greater and smaller? here is a code where you can check that which date is greater then other or same as vice verse. Simply copy and paste below code in your html file and run the file and change variable according to your need. Note: date format can be in two format one  2012-12-26 00:00:00  or 2012/12/26 00:00:00 Date compare <script> var s_date1 = "2012-12-26 00:00:00"; var en_date1 = "2012-12-26 00:00:00"; var s_date1_new=s_date1.replace(/-/g,"/"); // this line is for if date format is in hyphen like  2013-12-12 00:00:00 var en_date1_new=en_date1.replace(/-/g,"/"); // this line is for if date format is in hyphen like  2013-12-12 00:00:00 var date_ini = new Date(s_date1_new).getTime(); var date_end = new Date(en_date1_new).getTime(); if(isNaN(date_ini)) { alert("Start date format is wrong!"); return false; } if(isNaN(