wordpress_add

Showing posts with label dr-wordpress. Show all posts
Showing posts with label dr-wordpress. Show all posts

Wednesday, 4 June 2014

Solution of "Checkout Redirect not working" in wordpress

Some time you get this kind of error when you update plugin of toWooCommerce 

{"result":"failure","messages":"
\n\t\t\t
Action failed. Please refresh the page and retry.<\/li>\n\t\t\t
Sorry, your session has expired. Return to homepage →<\/a><\/li>\n\t\t\t
First Name<\/strong> is a required field.<\/li>\n\t\t\t
Last Name<\/strong> is a required field.<\/li>\n\t\t\t
Address<\/strong> is a required field.<\/li>\n\t\t\t
Town\/City<\/strong> is a required field.<\/li>\n\t\t\t



==========================Solution==========================
Method 1:
Create and new page named as "Thankyou" from admin-panel and put this short code in it [woocommerce_thankyou]
than publish that page with default template
than its works fine if it is not working than Go to
 WooCommerce plugin >> setting >> pages
than add thankyou page in thanks field and save it than your issue will resolved.

Method 2:

sometimes this issue seen when WOoCom pulgin conflict with other plugins, So try to deactivate plugin one by one than you will identify that plugin which create conflict.

Subscribe Dr-Wordpress for Important Knowledge of wordpress..your's suggestions are most welcomed.

Thursday, 30 January 2014

Pagination in wordpress

Pagination in wordpress

First of all download this plugin

https://codex.wordpress.org/Pagination

than paste this code in any template where you want to show all the posts


<?php 


// the query to set the posts per page to 3

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array('posts_per_page' => 3, 'paged' => $paged );
query_posts($args); ?>
<!-- the loop -->
<?php if ( have_posts() ) : while (have_posts()) : the_post(); ?>
  <!-- rest of the loop -->
  <!-- the title, the content etc.. -->
<?php endwhile; ?>
<!-- pagination -->
<?php next_posts_link(); ?>
<?php previous_posts_link(); ?>
<?php else : ?>
<!-- No posts found -->
<?php endif; ?>


if you want to show the post of specific category than replace this code in above code at line 2. 

$args = array('cat' => '7','posts_per_page' => 3, 'paged' => $paged );

NOTE : cat=>7 will be any Number ( ID of specific category)

Subscribe Dr-Wordpress for Important Knowledge of wordpress..your's suggestions are most welcomed.


Wednesday, 29 January 2014

Use two skype account at a same time..

How to run  Multiple instances of a software

Today i going to share an interesting information with you guys.how two use two skype accounts at a same time.

first login your first skype account with ordinary method for second account follow these steps

go to the command prompt 
than press 
win key + r
a dialog box will open than paste this line as it is in dialog box.
"C:\Program Files\Skype\Phone\Skype.exe" /secondary

[ Most of Computers have different Folder name like "Programs files (x86)" So replace that folder name in above path ]

Enjoy and give your feedback.

Subscribe Dr-Wordpress for Important Knowledge of wordpress..your's suggestions are most welcomed.



Thursday, 23 January 2014

Wordpress Search in Dr-wordpress

Wordpress Search : ( dr-wordpress.blogspot.com)

<form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
    <div>
        <input type="text" value="" name="s" id="s" placeholder="Search Here..." />
        <input type="submit" id="searchsubmit" value="" />
    </div>
</form>

just copy and paste this code and put it in search box area.. and enjoy searching..:)


Subscribe Dr-Wordpress for Important Knowledge of wordpress..your's suggestions are most welcomed.

Friday, 10 January 2014

Get checkbox value in PHP

Get checkbox value in PHP



<form action="index.php" method="post">

 <input type="checkbox" name="language[]" value="php" />PHP<br /> 
<input type="checkbox" name="language[]" value="html" />HTML<br /> 
<input type="checkbox" name="language[]" value="java" />Java<br />
 <input type="checkbox" name="language[]" value="c++" />C++<br /> 
<input type="submit" value="send" />

 </form>


foreach($_POST['language'] as $value)
 {
    echo 'Checked: '.$value.' ';
 }

If you check all the checkboxes, this script will output: 

Checked: php
Checked: html
Checked: java
Checked: c++

Subscribe Dr-Wordpress for Important Knowledge of wordpress..your's suggestions are most welcomed.

Thursday, 9 January 2014

Online image Mapping.

Image mapping in HTML

Just go to this website and add your image
Than you have different options right there draw online mapping with associated link.
Online code will generate copy that code and use it like i mentioned below in this POST

http://www.maschek.hu/imagemap/imgmap

How To use code :

Example:
**********************************************************
This code will generate by Online Tool.

<MAP NAME=mymap>

<AREA HREF="/reference/" ALT="HTML and CSS Reference" COORDS="5,5,95,195">
<AREA HREF="/design/" ALT="Design Guide" COORDS="105,5,195,195">
<AREA HREF="/tools/" ALT="Tools" COORDS="205,5,295,195">

</MAP>

**********************************************************

<IMG SRC="sitemap.gif" ALT="Site map" USEMAP="#mymap" WIDTH=300 HEIGHT=200>

Put this line with proper name (Highlighted in red font) 
---------------------------------------------------------

HTML allows images in different documents to use the same MAP definition from just one file, but many browsers do not support this and require the MAP and image elements to be in the same document.
MAP was originally defined to take one or more AREA elements that specify the coordinates of a clickable region on the image. An example follows:

Subscribe Dr-Wordpress for Important Knowledge of wordpress..your's suggestions are most welcomed.


Wednesday, 8 January 2014

Interview questions for Software Developers

Interview questions for fresher Software developers

hi i found a website where lots of important queries were asked. Visit this link

For php

http://www.pcds.co.in/php-interview-questions-and-answer.php

for .net development

http://www.pcds.co.in/dot-net-interview-questions-and-answers.php

Android Interview Questions And Answers

http://www.pcds.co.in/common-android-interview-questions-and-answers.php

Here is the link of blog which helps You alot for preparing interview questions


Subscribe Dr-Wordpress for Important Knowledge of wordpress..your's suggestions are most welcomed.

Saturday, 28 December 2013

Image resizing using Php

The following Code will easily allow you to resize images using PHP.
Awesome and simple method to resize image.while uploading new image. dr-wordpress


Copy and paste ( just run this code and check the flow of code.)


This is just a php function that passes the source image ( i.e., $source_img ), destination image ( $destination_img ) and quality for the image that will take to compress ( i.e., 90 ).
$filename = compress_image($_FILES["file"]["tmp_name"], $url, 80);
"80" is the quality of image (1-99) dr-wordpress
<---------------------------------------------------------------------------------------------------->
<?php
$name = ''; $type = ''; $size = ''; $error = '';
function compress_image($source_url, $destination_url, $quality) {

$info = getimagesize($source_url);

    if ($info['mime'] == 'image/jpeg')
        $image = imagecreatefromjpeg($source_url);

    elseif ($info['mime'] == 'image/gif')
        $image = imagecreatefromgif($source_url);

    elseif ($info['mime'] == 'image/png')
        $image = imagecreatefrompng($source_url);

    imagejpeg($image, $destination_url, $quality);
return $destination_url;
}

if ($_POST) {

    if ($_FILES["file"]["error"] > 0) {
        $error = $_FILES["file"]["error"];
   
    else if (($_FILES["file"]["type"] == "image/gif") || 
($_FILES["file"]["type"] == "image/jpeg") || 
($_FILES["file"]["type"] == "image/png") || 
($_FILES["file"]["type"] == "image/pjpeg")) {

        $url = 'destination .jpg';

        $filename = compress_image($_FILES["file"]["tmp_name"], $url, 80);
        $buffer = file_get_contents($url);

        /* Force download dialog... */
        header("Content-Type: application/force-download");
        header("Content-Type: application/octet-stream");
        header("Content-Type: application/download");

/* Don't allow caching... */
        header("Cache-Control: must-revalidate, post-check=0, pre-check=0");

        /* Set data type, size and filename */
        header("Content-Type: application/octet-stream");
        header("Content-Transfer-Encoding: binary");
        header("Content-Length: " . strlen($buffer));
        header("Content-Disposition: attachment; filename=$url");

        /* Send our file... */
        echo $buffer;
    }else {
        $error = "Uploaded image should be jpg or gif or png";
    }
}
?>
<html>
    <head>
        <title>Php code compress the image</title>
    </head>
    <body>

<div class="message">
                    <?php
                    if($_POST){
                        if ($error) {
                            ?>
                            <label class="error"><?php echo $error; ?></label>
                        <?php
                            }
                        }
                    ?>
                </div>
<fieldset class="well">
                <legend>Upload Image:</legend>                
<form action="" name="myform" id="myform" method="post" enctype="multipart/form-data">
<ul>
            <li>
<label>Upload:</label>
                               <input type="file" name="file" id="file"/>
</li>
<li>
<input type="submit" name="submit" id="submit" class="submit btn-success"/>
</li>
</ul>
</form>
</fieldset>
</body>
</html>


Subscribe Dr-Wordpress for Important Knowledge of wordpress..your's suggestions are most welcomed.

Tuesday, 19 November 2013

Count files in any directory using php..!!

Dr-Wordpress : how to count the number of files in any directory using php.


<?php 
    //Counts starts at 0
    $i = 0; 
    $dir = 'images/Trip_images/';
    if ($handle = opendir($dir)) {
        while (($file = readdir($handle)) !== false){
            if (!in_array($file, array('.', '..')) && !is_dir($dir.$file)) 
                $i++;
        }
    }
    // print count files in directory
    echo "There were $i files";
?>


Subscribe Dr-Wordpress for Important Knowledge of wordpress..your's suggestions are most welcomed.

Friday, 15 November 2013

How to Display Child Category name and link in Wordpress.

One line code for displaying child category with relevant link. Dr-Wordpress
 DISPLAY CHILD CATEGORY IN WORDPRESS....!!! (dr-wordpress)

NOTE : "3" IS THE ID OF PARENT CATEGORY

<?php wp_list_categories('orderby=id&show_count=1&use_desc_for_title=0&child_of=3'); ?>

Subscribe Dr-Wordpress for Important Knowledge of wordpress..your's suggestions are most welcomed.

Tuesday, 12 November 2013

MySQL Update Query In php..!!!

Dr-Wordpress : easy way to use update query in MySQL ( php )....!!!

<?php
ob_start();

 $db_name = 'database_name';
  $db_user = 'root';
  $db_pass = '';
 $db_host = 'localhost';
 $connection = mysql_connect($db_host, $db_user, $db_pass);
  mysql_select_db($db_name);

 ?>


$sql = "UPDATE $tablename  SET $column_name = '$value' WHERE Id='$id'";

   mysql_query($sql) or die(mysql_error());


Subscribe Dr-Wordpress for Important Knowledge of wordpress..your's suggestions are most welcomed.

Friday, 8 November 2013

jquery show/hide Effect with radio button...!!!

Jquery show/hide Effect with radio button

In dr-wordpress Today i going to share an important example of jquery.
I am Also badly stuck, when i am doing this.
So i am sharing this code with you people..
<!-----------------------------------------------HTML CODE------------------------------------>
<form>
<input id="id_radio1" type="radio" name="name_radio" value="value_radio1" checked="checked"/>Radio1

<input id="id_radio2" type="radio" name="name_radio" value="value_radio2" />Radio2

<input id="id_radio3" type="radio" name="name_radio" value="value_radio3" />Radio3
                 
</form>
              <div id="divs">
                   <div id="div1">One</div>
                   <div id="div2">Two</div>
                   <div id="div3">Three</div>     

              </div>
<!-----------------------------------------------CSS CODE----------------------------------------->
#divs div {
    display:none;

}
<!-----------------------------------------------Jquery CODE-------------------------------------->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
 $(function() {
          var $divs = $('#divs > div');
          $divs.first().show()
          $('input[type=radio]').on('change',function() {
                  $divs.hide();
                  $divs.eq( $('input[type=radio]').index( this ) ).show();
           });

});
<script>


Subscribe Dr-Wordpress for Important Knowledge of wordpress..your's suggestions are most welcomed.

Thursday, 7 November 2013

DR-WORDPRESS : How to make responsive design through media query.

At different resolution some time we need different style ( css ) for a particular div or span etc so we use media query for it.


NOTE: 980px means That less than 980px resolution   this is style is active.

 @media screen and (max-width: 980px) {

#header .inner 
{
    float: left;
    padding-left: 0px;
    width: 475px;
}

 }


Subscribe Dr-Wordpress for Important Knowledge of wordpress..your's suggestions are most welcomed.

Tuesday, 29 October 2013

Convert image into gradient color..!!! Dr-wordpress

Here is the URL of website which convert image into gradient color and gave code to user to use it on any website etc... Dr-wordpress
Wordpress Solutions Steps :

http://gradientfinder.com/

Uplaod your image 
And than it will auto generate the code of that image 


Subscribe Dr-Wordpress for Important Knowledge of wordpress..your's suggestions are most welcomed.



Wednesday, 18 September 2013

How to style the sub menu in word press Complete code..!!! Dr-wordpress

Here is the exact code to style you sub menu in wordpress.
Before using It just keep in mind the few things.
Note : .menu is the main menu.
           ( you can change it according to your design )

After It Just paste these line to your style Sheet. Than your menu is completely styled Just Change the color and effects according to you web design.. 

.menu
{
width:660px;
height:30px;
float:left;
margin-left:4px;
margin-top:30px;
}



.menu ul, .menu li {
    list-style: none outside none;
    margin: 0;
    padding: 0;
}
.menu li {
  /*  background-image: url("images/sep.gif");*/
    background-position: 0 15px;
    background-repeat: no-repeat;
    float: left;
    margin-left: 5px;
    margin-top: 2px;
    padding-left: 9px;
    position: relative;
}
.menu li.first {
    background-image: none;
    padding-left: 0;
}
.menu li a {
    color: #FFFFFF;
    display: block;
    padding: 8px 5px;
    text-decoration: none;
}
.menu li a:hover {
    color: #A59B00;
    text-decoration: none;
}
.menu ul {
    margin-left: 26px;
    margin-top: 43px;
}
.menu ul ul {
    display: none;
    float: left;
    left: 0;
    margin: 0;
    position: absolute;
    top: 34px;
    width: 150px;
    z-index: 200;
}
.menu ul ul li {
    background: none repeat scroll 0 0 transparent;
    border-bottom: 1px solid #716A00;
    float: none;
    height: auto;
    margin: 0;
    min-width: 120px;
    padding: 0;
}
.menu ul ul li a {
    background-color: #B7AF34;
    color: #FFFFFF;
    display: block;
    height: auto;
    line-height: 1em;
    padding: 5px 10px;
    text-decoration: none;
}
.menu ul ul li a:hover {
    background-color: #D2CA55;
    color: #FFFFFF;
}
.menu ul ul ul {
    left: 100%;
    top: 0;
}
.menu ul li:hover > ul {
    display: block;
}
.menu ul li.current_page_item > a, .menu ul li.current_page_ancestor > a, .menu ul li.current_menu_item > a, .menu ul li.current_page_parent > a {
    color: #A59B00;
}


Subscribe Dr-Wordpress for Important Knowledge of wordpress..your's suggestions are most welcomed.




Tuesday, 17 September 2013

How to Show Post in "Random Order " using Wordpress..!!!


Dr-wordpress : Today i am going to share a method of showing random POST in any word press page..just like QUIZ example or Captacha.You can also use it on different places where you want to show random POST's in wordpress...



wp_reset_query();

   query_posts("post_type=blog&posts_per_page=1&orderby=rand");
 
      while ( have_posts() ) : the_post();
$post_thumbnail_id = get_post_thumbnail_id( get_the_id() ); 
 $url=wp_get_attachment_image_src(  $post_thumbnail_id,"medium" );
?>

     <h1><?php the_title() ?></h1>



Subscribe us for Important Knowledge of wordpress ..your's suggestions are most welcomed.

Using "SLUG" how to get post and page content..!!!

SLUG are used in WordPress ( permalinks structure. ).Basically it is a unique name auto generated by word press. You can also change it...You get specific POST and page content by using slug.It is always in small letters with "-".

For example:

www.abc.com/slug-test

Here is the method to get Slug

<?php 
$slug = get_post( $post )->post_name;
echo $slug; 
?>

Now you have unique name use it and get the specific post and page content by using manual method of POST.


Subscribe Dr-Wordpress for Important Knowledge of wordpress..your's suggestions are most welcomed.

Monday, 16 September 2013

How to add "READ MORE" tag in wordpress Post..??

This the method to To add you "READ MORE" option in word press post or page..

NOTE: (243 is the dummy id)

$post_id2 = 243;
$queried_post2 = get_post($post_id2);
$title2 = $queried_post2->post_title;
echo substr($queried_post2->post_content,0,243);


Subscribe Dr-Wordpress for Important Knowledge of word press..your's suggestions are most welcomed.

How to get current URL at any page..??

This is the method to get URL of current page.Use and enjoy 

$link2=$_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] ;

$link_n2=explode('myvar',$link2);


echo $link_n2[1];




Subscribe Dr-Wordpress for Important Knowledge of word press..your's suggestions are most welcomed.


Get page content_in_tempalte..?

This is the method to get content on any template from WordPress edit panel.

<?php 
if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> 
         <?php the_content(); ?>
     <?php endwhile; ?>  
   <?php 
endif; ?>


Subscribe Dr-Wordpress for Important Knowledge of word press..your's suggestions are most welcomed.