Top Questions

  • 2.11 Years

    • Category : Wordpress
    • Location : Chandigarh, India
    • Posted On : Feb 13, 2019

    Disable default wp-cron.php behavior We can easily tell WordPress to let us handle the execution of wp-cron.php with the wp-config.php file.

    Open your wp-config.php file with the cPanel File Manager Code Editor
    
    Go to the bottom of the database settings in wp-config.php.
    define( 'AUTOSAVE_INTERVAL',    3600 );     // autosave 1x per hour
    define( 'WP_POST_REVISIONS',    false );    // no revisions
    define( 'DISABLE_WP_CRON',      true );
    define( 'EMPTY_TRASH_DAYS',     7 );        // one week
    
    Now WordPress will not automatically run the wp-cron.php script each time your site gets a new visitor.
  • 2.9 Years

    • Category : Php
    • Location : Chandigarh
    • Posted On : Jan 7, 2016
    if(isset($_GET['mintime']) && isset($_GET['maxtime'])){
        $extraconditionsa = $extraconditionsa ."and TIME_FORMAT (
       str_to_date (
           replace (hour,':',''),'%H%i'),'%H:%i') between '{$_GET['mintime']}' AND '{$_GET['maxtime']}'";
    }
    
    // mysql:How do I check if a column is empty or null in mysql
    SELECT * FROM table_name WHERE NULLIF(some_col, '') IS NULL;

     

  • 2.11 Years

    • Category : Yii2
    • Location : Chandigarh, India
    • Posted On : Feb 4, 2019

    If you just want to remove packages or extension from the vendor directory you can use composer command:

    composer remove package/name

    For Example:

    composer require 2amigos/yii2-ckeditor-widget (for Installation)
    composer remove 2amigos/yii2-ckeditor-widget (for remove)
  • 5.11 Years

    • Category : Wordpress
    • Location : Mohali
    • Posted On : Feb 20, 2018

    If you want to add custom navigation menus in your WordPress templates? By default, many WordPress themes come with pre-defined menu locations and layouts. follow this article:

    <?php $defaults = array(
        'menu'            => 'main',
        'container'       => 'div',
        'container_class' => 'navbar-collapse collapse',
        'container_id' => 'navbar',
        'menu_class'      => 'nav navbar-nav navbar-right',
        'echo'            => true,
        'fallback_cb'     => 'wp_page_menu',
        'items_wrap'      => '<ul id="%1$s" class="%2$s">%3$s</ul>'
    );
    ?>
     
    <?php wp_nav_menu( $defaults ); ?>
    
    /* Output */
    
    <div id="navbar" class="navbar-collapse collapse">
    	<ul id="menu-main" class="nav navbar-nav navbar-right">
    		<li id="menu-item-108" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-home current-menu-item page_item page-item-2 current_page_item menu-item-108"><a href="http://www.example.com/">Home</a></li>
    	</ul>
    </div>
  • 2.9 Years

    • Category : Php
    • Location : Chandigarh
    • Posted On : Jun 5, 2016

    Display limited o of word from a string using this code

    echo mb_strimwidth('It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using Content here, content here, making it look like readable English', 0, 50, "...");
     
  • 2.9 Years

    • Category : Wordpress
    • Location : Chandigarh
    • Posted On : Apr 7, 2016

    Its helps to register user in your wordpress site.Before use go to -> settitng -> General setting -> Register anyone -> role(Subscriber).

    <?php echo apply_filters( 'register', sprintf( '<a class="btn btn-danger" href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ) ); ?>
     
  • 2.9 Years

    • Category : Jquery
    • Location : Chandigarh
    • Posted On : Feb 12, 2017

    JQuery Ajax form using boostrap validation

     $(document).on('submit','#formid',function(){
     $(this).formValidation({
                                framework: 'bootstrap',
                                fields: {
                                    name: {
                                        validators: {
                                            notEmpty: {
                                                message: 'The name is required'
                                            }
                                        }
                                    },
                                    email: {
                                        validators: {
                                            notEmpty: {
                                                message: 'The email is required'
                                            }
                                        }
                                    },
                                    password: {
                                        validators: {
                                            notEmpty: {
                                                message: 'The password is required'
                                            }
                                        }
                                    },
                                }
                            })
                            .on('success.form.fv', function(e) {
                                e.preventDefault();
                               var Formdata=$(this).serialize();
                                $.ajax({
                                    type: "POST",
                                    url: '', //add page url here
                                    data: Formdata, //send data from here,
                                    success: function(data) {
                                        alert(data);
                                    }
                                });
                            });
                     });
     
  • 5.11 Years

    • Category : Php
    • Location : Mohali
    • Posted On : Sep 15, 2016

    fix “Headers already sent” error in PHP

    The very quick fix for your problem will be to add

    ob_start();
    as the very first thing in your script if you only need it in this one script. If you need it in all your scripts add it as the very first thing in your header.php file.
  • 5.11 Years

    • Category : Php
    • Location : Mohali
    • Posted On : Nov 23, 2017

    There's a bug in Wordpress 4.9, I discovered this temporary super code. I plan on uninstalling it once they fix the bug, but it works great in the meantime!

    global $wpdb;
    $wpdb->query( "DELETE FROM `$wpdb->options` WHERE `option_name` LIKE '_transient_files_%' LIMIT 1" );
     
  • 5.11 Years

    • Category : Html
    • Location : Mohali
    • Posted On : Dec 19, 2017

    This is another Client Side Validation strategy No JavaScript or jQuery required, Thanks to HTML5 in light of the fact that approvals should now be possible utilizing HTML5 without coding of javascript or any server side dialect, utilizing HTML5 you can approve frames with design, Forms must be approve either utilizing customer side or server side since it causes you to gather redress information or substantial shape esteems from the clients, you can't trust clients aimlessly, how about we see it.

    pattern="[A-Za-z] " accepts only capital or small letters. 
    <label>Name : (letters only)*</label>
    <input type="text" pattern="[A-Za-z] " title="only letters" required />
    
    pattern="[a-z0-9._% -] @[a-z0-9.-] \.[a-z]{2,4}$" accepts valid email address 
    <label>E-mail : (xyz@zyx.com)*</label>
    <input type="email" pattern="[a-z0-9._% -] @[a-z0-9.-] \.[a-z]{2,4}$" title="xyz@something.com" required />
    
    pattern="https?://. " required title="https://dorcode.com" accepts valid web url starting with http://. 
    <label>website : (https://dorcode.com)*</label>
    <input type="url"  pattern="https?://. " title="https://dorcode.com" required />
    
    pattern="[0-9] " accepts only numbers 0, 1, 2.... 
    <label>pin code : (numbers only)</label>
    <input type="text" pattern="[0-9] " title="numbers only" required />
    
    pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" accepts one number one upper and lower case letters with 8 or more chars. 
    <label>password : (at least 6 chars)</label>
    <input type="password" pattern=".{6,}" title="Six or more characters" required />
    
    pattern="^\d{10}$" accepts only numeric values with 10 digit. 
    <label>phone no : (10 chars)</label>
    <input type="tel" pattern="^\d{10}$" title="10 numeric characters only" required />
    
    pattern="^[a-zA-Z][a-zA-Z0-9-_\.]{5,12}$" accepts alphanumeric values letters and digits.