This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var getClosestNum = function(num, ar) { | |
| var i = 0, closestDiff, currentDiff; | |
| if(ar.length) { | |
| closest = ar[0]; | |
| for(i;i<ar.length;i++) { | |
| closestDiff = Math.abs(num - closest); | |
| currentDiff = Math.abs(num - ar[i]); | |
| if(currentDiff < closestDiff) { | |
| closest = ar[i]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| try{ | |
| return JSON.parse(my_string); | |
| }catch(err){ | |
| return JSON.parse('"'+my_string+'"'); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var items = $('.element'); | |
| items.animate( | |
| {opacity:0}, | |
| { | |
| duration:2000, | |
| complete: function(){ | |
| // This would be called on each item | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter( 'post_thumbnail_html', 'remove_width_attribute', 10 ); | |
| add_filter( 'image_send_to_editor', 'remove_width_attribute', 10 ); | |
| function remove_width_attribute( $html ) { | |
| $html = preg_replace( '/(width|height)="\d*"\s/', "", $html ); | |
| return $html; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function cc_mime_types( $mimes ){ | |
| $mimes['svg'] = 'image/svg+xml'; | |
| return $mimes; | |
| } | |
| add_filter( 'upload_mimes', 'cc_mime_types' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11); | |
| function my_jquery_enqueue() { | |
| wp_deregister_script('jquery'); | |
| wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", false, null); | |
| wp_enqueue_script('jquery'); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php echo do_shortcode("[shortcode]"); ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); echo '?' . filemtime( get_stylesheet_directory() . '/style.css'); ?>" type="text/css" media="screen"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $imgsrc = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), "Full"); | |
| echo $imgsrc[0]; | |
| ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function limit_words($string, $word_limit) { | |
| $words = explode(' ', $string); | |
| return implode(' ', array_slice($words, 0, $word_limit)); | |
| } | |
| ?> | |
| #usage: | |
| <?php echo limit_words(get_the_excerpt(), '41'); ?> |
OlderNewer