Posts

Showing posts from 2014

How to Add Pagination in Your Custom Template

1.Add following codes in your page template before starting posts query.  $args = array(                 'post_type'  => 'post',                 'meta_key' => '_thumbnail_id',                 'posts_per_page' => 7,                 'paged' => $paged);             $query = new WP_Query($args); 2.After end of While loop and before close of IF statement paste following code. echo '     <div id="wp_pagination">         <a class="first page button" href="'.get_pagenum_link(1).'">&laquo;</a>         <a class="previous page button" href="'.get_pagenum_link(($curpage-1 > 0 ? $curpage-1 : 1)).'">&lsaquo;</a>';         for($i=1;$i<=$query->max_num_pages;$i++)             echo '<a class="'.($i == $curpage ? 'active ' : '').'page button" href="'.get_p

How to reduce excerpt Length and remove dots with Readmore link in Wordpress

1.Go to your functions.php file and paste following code. <?php function change_excerpt_length($length) {     return 10 ; } add_filter('excerpt_length', 'change_excerpt_length'); function new_excerpt_more( $more ) {     return ' <a class="read-more" href="'. get_permalink( get_the_ID() ) . '">' . __(' Read More ', 'http://your_domain/') . '</a>'; } add_filter('excerpt_more', 'new_excerpt_more'); ?> Thanks

Add Custom Widget Area in Wordpress

First you’ll want to add this code to your active theme’s function.php file. This code is used to register the custom widget area and create it on the backend. // Custom widget area.   register_sidebar( array (      'name' => __( 'Custom Widget Area' ),      'id' => 'custom-widget-area' ,      'description' => __( 'An optional custom widget area for your site' , 'twentyten' ),      'before_widget' => '<li id="%1$s" class="widget-container %2$s">' ,      'after_widget' => "</li>" ,      'before_title' => '<h3 class="widget-title">' ,      'after_title' => '</h3>' , ) ); Next you’ll want to add this code to whichever page template you’d like the widget area to show up on. This code is used to display the custom widget area in any locatio

Angular JS Directives

There are following Directives in Angular Js . ng-app directives initializes an angular application. ng-init initialize a application data. ng-model binds the value of html controls(button,text) to application data. ng-bind  display application data

Create New Project in Laravel

first install composer from   here . then go to your cmd Prompt in windows. go to your wamp directory and type following command. composer create-project laravel/laravel project_name --presfer-dist now laravel download in your directory with project-named folder now open this and enjoy with laravel....

How to Disable Keyboard on Any Web Page

<script> document.onkeydown = function (e) { return false; } </script>   FOR SAMLL PART OR DIV   <script> $ ( selector ). keydown ( function ( event ) { return false ; }); </script>

How to Add Favicon Image in Your Html Site

<link rel = "shortcut icon" type = "image/png" href = "/favicon.png" /> <link rel = "shortcut icon" type = "image/png" href = "http://eg.com/favicon.png" />

how to send mail with background images

<?php $to = "kr.krishna1995@gmail.com"; $subject = "hello how are you."; $message = " <html> <head> <title>HTML email</title> </head> <body> <p>This email contains HTML Tags!</p> <table background='http://www.rapscspl.com/forest/wp-content/uploads/2014/10/teresa-pic.png'> <tr> <th>Firstname</th> <th>Lastname</th> <form> </tr> <tr> <td>John</td> <td>Doe</td> </tr> </table> </body> </html> "; // Always set content-type when sending HTML email $headers = "MIME-Version: 1.0" . "\\r\ "; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\\r\ "; // More headers $headers .= 'From: <vikashgupta40@gmail.com>' . "\\r\ "; $headers .= 'Cc: myboss@example.com' . "\\r\ "; mail($to,$su

HOW TO CHANGE WORDPRESS ADMIN PASSWORD.

Image
GO TO MYSQL CONSOLE RUN FOLLOWING QUERY SELECT YOUR DATEBASE OR GO TO YOUR phpmyadmin. SELECT YOUR DATABASE. BROWSE wp_user TABLE. CHECK ADMIN AND EDIT. CHANGE wp_pass WITH SELECTING md5 in FUNCTION COLUMN. AND CLICK AND go. 

Dropdown Menu in Css and Html

DROPDOWN MENU IN CSS AND HTML HTML <ul id="menu">                 <li><a href="#">Mobile</a>                                    <ul class="submenu">                                        <li><a href="#">sony</a></li>                     <li><a href="#">apple</a></li>                     <li><a href="#">micromax</a></li>                     </ul>                                    </li>                 <li class="tablet"><a href="#">tablet</a></li>                                               <li class="accessries"><a href="#">accessries</a></li>                                   </ul> CSS ul#menu,ul#menu ul.submenu{ margin:0; padding:0; } ul#menu li,ul#menu ul.submenu li { list-style-

Register and Display Widget Area In Wordpress

Image
<?php /** * Register Widget Area. * */ function wpgyan_widgets_init ( ) {      register_sidebar ( array (          'name' = > 'Header Sidebar' ,          'id' = > 'header_sidebar' ,          'before_widget' = > '<div>' ,          'after_widget' = > '</div>' ,          'before_title' = > '<h2 class="rounded">' ,          'after_title' = > '</h2>' ,      ) ) ; } add_action ( 'widgets_init' , 'wpgyan_widgets_init' ) ; ?> Paste this code into your theme's functions.php file. Now you could see widget area into site backend navigating Appearance -> Widgets. . Now you could place Widgets on this widget area using available widgets. DISPLAY WIDGET AREA Once you have added content. Now you could show this widget area on required position in theme

Write Excel file using PHP and MYSQL Records

GENERATE EXCEL FILE USING PHP AND MYSQL Here is the following code to generate excel file. <?php $dbhost= "Mysql server name"; //your MySQL Server $dbuser = "Username"; //your MySQL User Name $dbpass = "password"; //your MySQL Password $dbname = "database name"; //your MySQL Database Name of which database to use this $tablename = "table"; //your MySQL Table Name which one you have to create excel file // your mysql query here , we can edit this for your requirement $sql = "Select * from $tablename "; //create  code for connecting to mysql $Connect = @mysql_connect($dbhost, $dbuser, $dbpass) or die("Couldn't connect to MySQL:<br>" . mysql_error() . "<br>" . mysql_errno()); //select database $Db = @mysql_select_db($dbname, $Connect) or die("Couldn't select database:<br>" . mysql_error(). "<br>" . mysql_errno()); //execute query $resu