This file contains 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 hip_detect_shortcode( $shortcode = false ) { | |
$shortcode_found = false; | |
if( $shortcode && is_singular() ) { | |
global $post; | |
$pattern = get_shortcode_regex(); | |
This file contains 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 hip_is_mobile() { | |
if( strpos( $_SERVER['HTTP_USER_AGENT'], 'iPad' ) ) { | |
$cookie = $_COOKIE['is_mobile']; | |
if( $cookie == 'yes' ) | |
return true; | |
else | |
return false; | |
} else { |
This file contains 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 | |
/* | |
Plugin Name: Extended sanitize filename | |
Plugin URI: | |
Description: Replace and/or remove accents and other special characters in filenames on upload | |
Version: 1 | |
Author: Hippies | |
Author URI: http://hippies.se | |
*/ | |
add_filter( 'sanitize_file_name', 'extended_sanitize_file_name', 10, 2 ); |
This file contains 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 check_for_thumb( $post ){ | |
global $post; | |
$post_type = get_post_type( $post->ID ); | |
$post_thumb = get_post_meta( $post->ID, '_thumbnail_id', true ); | |
if( $post_type === 'bildspel' && isset( $_GET['post'] ) && $_GET['action'] === 'edit' && empty( $post_thumb ) ) { | |
echo "<div class='error'><p>Posten saknar utvald bild</p></div>"; | |
} |
This file contains 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 | |
add_filter( 'get_image_tag_class', 'add_generic_image_class'); | |
function add_generic_image_class( $class ) { | |
$class .= ' my-image-class'; | |
return $class; | |
} |
This file contains 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 list_hooked_functions($tag=false){ | |
global $wp_filter; | |
if ($tag) { | |
$hook[$tag]=$wp_filter[$tag]; | |
if (!is_array($hook[$tag])) { | |
trigger_error("Nothing found for '$tag' hook", E_USER_WARNING); | |
return; | |
} | |
} |
This file contains 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 | |
/** | |
* Adds a box to the main column on the Post and Page edit screens. | |
*/ | |
function myplugin_add_custom_box() { | |
$screens = array( 'post', 'page' ); | |
foreach ( $screens as $screen ) { |
This file contains 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
jQuery(document).ready(function($){ | |
var status = notices.post_status, | |
savePostBtn = $("#save-post"), | |
publishPostBtn = $("#publishing-action #publish"); | |
if( status != "publish" && status != 0 ) { | |
publishPostBtn.removeClass("button-primary"); | |
savePostBtn.addClass("button-primary"); | |
} | |
}); |
This file contains 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 | |
/* | |
Plugin Name: Hippies attachments noindex | |
Plugin URI: | |
Description: Do not index attachment pages and set default image link type to "none" on plugin activation. | |
Version: 1 | |
Author: Hippies | |
Author URI: http://hippies.se/ | |
*/ | |
add_action( 'wp_head', 'hip_attachments_noindex_wp_head' ); |