To hide the scroll bar of the background page when the colorbox opens "like facebook for example" /* make the page scroll dissapear when colorbox is open and retrieved back when colorbox is closed */ var screen_position; $(document).bind('cbox_open', function() { screen_position = $("body").scrollTop(); $('body').css({ overflow: 'hidden' }); $("body").scrollTop(0); }).bind('cbox_closed', function() { $('body').css({ overflow: 'auto' … Continue reading jQuery Colorbox: Hide background page vertical scroll bar on open
Month: October 2013
if (typeof FileReader !== "undefined") { var size = document.getElementById('upload_file').files[0].size; size = Math.round(size / 1024); console.log(size+' KB'); }
<?php /** * WordPress Query Comprehensive Reference * Compiled by luetkemj - luetkemj.com * * CODEX: http://codex.wordpress.org/Class_Reference/WP_Query * Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php */ $args = array( //////Author Parameters - Show posts associated with certain author. 'author' => 1,2,3, //(int) - use author id [use minus (-) to exclude authors by ID ex. 'author' => -1,-2,-3,] 'author_name' => … Continue reading WordPress: Using WP_Query Arguments
/** * get the sources of img tags from html input parameter */ function get_html_img_sources($html){ //$html = types_render_field( "gallery_image", array( "size" => "medium", "proportional" => "true",'output'=>'raw') ); if(empty($html)) return array(); $doc = new DOMDocument(); $doc->loadHTML($html); $imageTags = $doc->getElementsByTagName('img'); $img_src_arr = array(); foreach($imageTags as $tag) { $img_src_arr[] = get_site_url().'/'.substr( $tag->getAttribute('src'), strrpos( $tag->getAttribute('src'), '/wp-content' )+1 ); } … Continue reading Get the sources of img tags from html
Using the bake command, cakephp will read all your source files and it will extract all the text to translate. So it’s very important that you write the string in the i18n function and don’t pass just variables. For example to extract the text, using the command line go to you app directory, and execute … Continue reading CakePHP: generate .po localization files using Shell