Top Questions

  • 5.11 Years

    • Category : Php
    • Location : Mohali
    • Posted On : Apr 18, 2016

    When i click the first upload field (uploading process are success) after insert into post that corresponding media url is appear in the second field not in first. I am not sure where is the problem any suggestion would be great.

    // This will enqueue the Media Uploader script
        <label for="image_url">Image</label>
        <input type="text" name="image_url" id="image_url" class="regular-text">
        <input type="button" name="upload-btn" id="upload-btn" class="button-secondary" value="Upload Image">
    <script type="text/javascript">
        $('#upload-btn').click(function(e) {
            var image ={ 
                title: 'Upload Image',
                // mutiple: true if you want to upload multiple files at once
                multiple: false
            .on('select', function(e){
                // This will return the selected image from the Media Uploader, the result is an object
                var uploaded_image = image.state().get('selection').first();
                // We convert uploaded_image to a JSON object to make accessing it easier
                // Output to the console uploaded_image
                var image_url = uploaded_image.toJSON().url;
                // Let's assign the url value to the input field
    function load_wp_media_files() {
    add_action( 'admin_enqueue_scripts', 'load_wp_media_files' );
  • 5.11 Years

    • Category : Htaccess
    • Location : Mohali
    • Posted On : Dec 15, 2015

    Speed-up your website with these simple .htaccess tricks

    # Do not remove this line or mod_rewrite rules and search engine friendly URLs will stop working
    RewriteBase /
    # BEGIN Cache-Control Headers
    <ifModule mod_headers.c>
     <filesMatch ".(ico|jpe?g|png|gif|swf)$">
       Header set Cache-Control "public"
     <filesMatch ".(css)$">
       Header set Cache-Control "public"
     <filesMatch ".(js)$">
       Header set Cache-Control "private"
     <filesMatch ".(x?html?|php)$">
       Header set Cache-Control "private, must-revalidate"
    # END Cache-Control Headers
    <ifmodule mod_expires.c>
    <Filesmatch "\.(jpg|jpeg|png|gif|js|css|swf|ico|woff|mp3)$">
        ExpiresActive on
        ExpiresDefault A2592000
  • 5.11 Years

    • Category : Php
    • Location : Mohali
    • Posted On : Dec 7, 2015