Skip to content

Instantly share code, notes, and snippets.

View upload_mime.php
<?php
add_filter('upload_mimes','external_mimes');
function external_mimes($mimes){
return array_merge($mimes,array (
'rar'=> 'application/x-rar-compressed', // you can add more?
));
}
View content-heading-auto-id.php
<?php
/**
* Content heading auto ID
*
* Examples;
* <h*>Test Header</h*>
* <h* id="test-header">Test Header</h*>
*/
View for-a-clean-bxslider.css
/*
* For a clean bxSlider!
*/
.bx-wrapper .bx-viewport {
background : none;
border : 0px;
left : 0px;
-moz-box-shadow : none;
-webkit-box-shadow : none;
View selectbox_menu_walker.php
<?php
/**
* SelectBox box menu walker
* @author : takien, tarikcayir
* @link : http://takien.com
* @version : 1.1
*
* use this on args:
* 'walker' => new SelectBox_Menu_Walker,
* 'items_wrap' => '<select id="%1$s" class="%2$s">%3$s</select>',
View wordpress_html5_insert_image_figure.php
<?php
/**
* Change image tag
*/
add_filter( 'image_send_to_editor', 'html5_insert_image', 10, 9 );
function html5_insert_image($html, $id, $caption, $title, $align, $url, $size, $alt) {
View remove_p_tags.php
<?php
add_filter('the_content', 'remove_p_tags', 20, 1);
function remove_p_tags($content){
$content = force_balance_tags($content);
return preg_replace('#<p>\s*+(<br\s*/*>)?\s*</p>#i', '', $content);
}
View bxslider-control-hover.css
/**
* Controls hover fade effect!
*
* Change class name -> slider_class_name
*/
.bx-controls-direction {
opacity: 0;
transition: opacity .25s ease-in-out;
-moz-transition: opacity .25s ease-in-out;
View wordpress-3.8-dashicons.php
<?php
/*
* WP 3.8 Add CPT Admin icon
*/
add_action( 'admin_head', 'cpt_admin_icon' );
function cpt_admin_icon(){
echo '
<style>
#adminmenu #menu-posts-project div.wp-menu-image:before { content: "\f100"; }
View wp-load-fancybox-modal.php
<?php
/*
* Load jQuery FancyBox Modal!
*/
add_action('wp_enqueue_scripts', 'fancbox_scripts');
function fancbox_scripts() {
wp_enqueue_style('fancybox-style', get_template_directory_uri().'/fancybox/jquery.fancybox.css', false ,'2.1.5', 'all' );
wp_enqueue_script('fancybox', get_template_directory_uri().'/fancybox/jquery.fancybox.min.js', array('jquery'),'2.1.51', true );
View wp-add-class-attachment-link.php