Skip to content

Instantly share code, notes, and snippets.

View cheh's full-sized avatar

Dima Chekhovskyi cheh

View GitHub Profile
function custom_shortcode_scripts() {
global $post;
if( has_shortcode( $post->post_content, 'custom-shortcode') ) {
wp_enqueue_script( 'custom-script');
}
}
add_action( 'wp_enqueue_scripts', 'custom_shortcode_scripts');
- Diff
- EditorConfig
- Emmet
- HTML-CSS-JS Prettify
- JSHint
- Local History
- Sass
- SideBarEnhancements
- SublimeLinter
- SublimeLinter-css-lint
<?php
/**
* Display Post Image and Caption
*
* @link http://www.billerickson.net/wordpress-featured-image-captions/
* @author Bill Erickson
*
*/
function be_display_image_and_caption() {
<?php
/**
* Add description to menu
* @author Bill Erickson
* @link http://www.billerickson.net/code/add-description-to-menu
*
* @param string $item_output
* @param object $item
* @return string modified item output
*/
<?php
/**
* Customize Read More Link
* @author Bill Erickson
* @link http://www.billerickson.net/read-more-link
*
* @param string
* @return string
*/
function be_more_link($more_link) {
<?php
/**
* Add Extra Code to Any Menu
* @author Bill Erickson
* @link http://www.billerickson.net/customizing-wordpress-menus/
*
* @param string $menu
* @param object $args
* @return string modified menu
*/
<?php
// Trims by word
wp_trim_words( $text, $num_words, $moretext );
// Trims by character (and strips HTML)
wp_html_excerpt( $str, $num_char );
<?php
/**
* Black and White Image
* @url http://ottopress.com/2011/customizing-wordpress-images/
*
* @param array $meta
* @return array $meta
*/
function be_bw_filter($meta) {
<?php
/**
* Enqueue iOS bug fix
*
*/
function be_enqueue_ios_bug_fix() {
wp_enqueue_script( 'be-ios-bug', get_stylesheet_directory_uri() . '/lib/js/ios-bug.js' );
}
<?php
/**
* Add Custom Image Sizes to Media Uploader
* @author Pippin Williamson
* @link http://pippinsplugins.com/add-custom-image-sizes-to-media-uploader/
*
* @param array $sizes
* @return array
*/