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 custom_page_title( ) { | |
$id = get_parent_id(); | |
$post = get_queried_object(); | |
$postType = get_post_type_object(get_post_type($post)); | |
if ( is_category() ) { | |
$title = single_cat_title( '', false ) ; | |
} elseif ( is_tag() ) { |
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 | |
/* functions.php */ | |
add_filter( 'the_content', 'my_filter_function' ); // hook into the_content() | |
function my_filter_function( $content ){ | |
$new_content = str_replace( 'old', 'new', $content ); // modify content | |
return $new_content; | |
} |
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 add_body_class_by_meta ( $classes ) { | |
global $post; | |
$custom_classes = array(); | |
$meta_invert = get_post_meta( $post->ID, 'metabox_page_invert', TRUE ); | |
if ( $meta_invert == 'on') { | |
$custom_classes = array('ab-dark'); | |
} | |
$return = array_merge( $classes, $custom_classes ); | |
return $return; | |
} |
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 orientation classes to each image: landscape / portrait / square | |
$("img").each(function (i) { | |
var img_class; | |
var height = parseInt ( $(this).attr( "height" ) ); | |
var width = parseInt ( $(this).attr( "width" ) ); | |
if ( width > height ) { | |
img_class = 'landscape'; | |
} else if ( width < height) { | |
img_class = 'portrait'; | |
} else { |
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 | |
/* Load template from plugins folder | |
* via http://wordpress.stackexchange.com/questions/17385/custom-post-type-templates-from-plugin-folder | |
*/ | |
function load_person_template($template) { | |
global $post; | |
// Is this a "my-custom-post-type" post? |
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
// Prevent Wordpress from adding emoji and smiley js and css | |
remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); | |
remove_action( 'wp_print_styles', 'print_emoji_styles' ); |
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 | |
sendMessage( „Hallo Jasper", $diekamp ) { | |
while ( $diekamp->status == „unavailable“) { | |
$egermann->wait( 1 day ); | |
$egermann->daeumchendreh(); | |
} | |
} | |
?> |
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
# csv: extract rows and save as new csv | |
import csv | |
in_f = open('test.csv') | |
out_f = open('out.csv', 'wb') | |
reader = csv.DictReader(in_f) | |
# Define column names |
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 | |
/** | |
* Adds category_children_widget widget. | |
*/ | |
class category_children_widget extends WP_Widget { | |
/** | |
* Register widget with WordPress. | |
*/ |