Friday, 30 June 2017

Client Side Validation in Ckeditor or CKeditor Validation

Note: include JQuery  file and JQuery validation files

STEP NO : 1

<form action="#" method="post" id="formId">
<label>Description</label><textarea name="blog_description" class="required" id="editor1"></textarea>
            <script>
                CKEDITOR.replace('editor1');
            </script>

<input name="submit" type="submit" value="Submit Job" class="button" id="job-submit"/>
<input name="clear" type="reset" value="Clear Form"  class="button"/>
</form>

Thursday, 22 June 2017

How to get post image in worpdress or How to get post thumbnail in wordpress

//Default WordPress


// Thumbnail (150 x 150 hard cropped)


<?php    the_post_thumbnail( 'thumbnail' );       ?>

// Medium resolution (300 x 300 max height 300px)  
<?php the_post_thumbnail( 'medium' ); ?>  

 // Medium Large (added in WP 4.4) resolution (768 x 0 infinite height)    
<?php the_post_thumbnail( 'medium_large' ); ?> 

// Large resolution (1024 x 1024 max height 1024px)
<?php the_post_thumbnail( 'large' );  ?>    

// Full resolution (original size uploaded)
<?php the_post_thumbnail( 'full' );  ?>      


//With WooCommerce


// Shop thumbnail (180 x 180 hard cropped)


<?php the_post_thumbnail( 'shop_thumbnail' ); ?>  

// Shop catalog (300 x 300 hard cropped)
<?php the_post_thumbnail( 'shop_catalog' );  ?>   

 // Shop single (600 x 600 hard cropped)
<?php the_post_thumbnail( 'shop_single' ); ?>    

Tuesday, 20 June 2017

How to change dynamic background color

Script for change background color : Dynamic color 


<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

<script>
    jQuery(function ($) {
        function changeColor(selector, colors, time) {
            var curCol = 0,
                    timer = setInterval(function () {
                        if (curCol === colors.length)
                            curCol = 0;
                        $(selector).css("background", colors[curCol]);
                        curCol++;
                    }, time);
        }
        $(window).load(function () {
            changeColor("#wrap", ["linear-gradient(to right, rgb(241, 242, 181), rgb(19, 80, 88))", "linear-gradient(to right, rgb(209, 145, 60), rgb(255, 209, 148))", "linear-gradient(to right, rgb(254, 172, 94), rgb(199, 121, 208), rgb(75, 192, 200))", "linear-gradient(to right, rgb(123, 67, 151), rgb(220, 36, 48))","linear-gradient(to right, rgb(112, 225, 245), rgb(255, 209, 148))","linear-gradient(to right, rgb(64, 59, 74), rgb(231, 233, 187))","linear-gradient(to right, rgb(58, 28, 113), rgb(215, 109, 119), rgb(255, 175, 123))","url('https://www.planwallpaper.com/static/images/Seamless-Polygon-Backgrounds-Vol2-full_Kfb2t3Q.jpg')"], 3000);
        });
    });
</script>

Monday, 19 June 2017

Only show current month of post in wordpress

<?php $current_month = date('m'); ?>

<?php $current_year = date('Y'); ?>

<?php query_posts("monthnum=$current_month&year=$current_year") ?>

<?php if ( have_posts() ) : ?>

<?php while ( have_posts() ) : the_post(); ?>

<?php the_content(); ?>

<?php endwhile; ?>

<?php else : ?>

<?php endif; ?>