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 link field to WP_Widget_Text (the native text widget) | |
*/ | |
add_action( 'in_widget_form', 'hip_textwidget_in_widget_form', 1, 3 ); | |
add_filter( 'widget_update_callback', 'hip_textwidget_in_widget_form_update', 1, 4 ); | |
add_filter( 'dynamic_sidebar_params', 'hip_textwidget_dynamic_sidebar_params' ); | |
function hip_textwidget_in_widget_form( $item, $return, $instance ){ | |
if( $item->id_base !== "text" ) |
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: User Access Manager - Widgets addon | |
Plugin URI: | |
Description: Manage the access for widgets. Requires <a href="http://www.gm-alex.de/projects/wordpress/plugins/user-access-manager/">User Access Manager</a>. | |
Version: 1 | |
Author: Hippies | |
Author URI: http://hippies.se/ | |
************************************************************************** |
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_action( 'widgets_init', 'PREFIX_register_widgets' ); | |
function PREFIX_register_widgets(){ | |
register_widget( 'WP_Widget_FOOBAR' ); | |
} | |
class WP_Widget_FOOBAR extends WP_Widget { | |
/** | |
* Register widget with WordPress. | |
*/ |
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 | |
$term_description = term_description(); | |
if ( ! empty( $term_description ) ) : | |
echo '<div class="term-description">'; | |
echo apply_filters( "the_content", $term_description ); | |
echo '</div>'; | |
endif; |
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 | |
/** | |
* Replace the default textarea#decription on terms with a WYSIWYG field | |
*/ | |
add_action( 'admin_init', 'hip_replace_term_description_field', 10, 2 ); | |
function hip_replace_term_description_field() { | |
$taxonomies = get_taxonomies( array( 'public' => true ) ); | |
foreach ( $taxonomies as $taxonomy ) { | |
add_action( $taxonomy . '_add_form_fields', 'hip_wysiwyg_term_description', 10, 2 ); | |
add_action( $taxonomy . '_edit_form_fields', 'hip_wysiwyg_term_description', 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
// Autosave, do nothing | |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) | |
return; | |
// AJAX | |
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) | |
return; | |
// Check user permissions | |
if ( ! current_user_can( 'edit_post', $post_id ) ) | |
return; | |
// Return if it's a post revision |
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 | |
/** | |
* Move advanced meta boxes to below after the title | |
*/ | |
function hip_mc_move_settings_box() { | |
# Get the globals: | |
global $post, $wp_meta_boxes; | |
$posttype = "post"; |
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 | |
/* | |
Simply put the desired image size in the_post_thumbnail( $size ); | |
Sizes are declared as [height-in-pixels]x[width-in-pixels]. | |
Example: the_post_thumbnail('400x300'); | |
Dependencies: http://matthewruddy.github.io/Wordpress-Timthumb-alternative/ | |
*/ | |
add_filter( 'post_thumbnail_html', 'matthewruddy_post_thumbnail_resize', 20, 5 ); | |
function matthewruddy_post_thumbnail_resize( $html, $post_id, $post_thumbnail_id, $size, $attr ) { |
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 | |
$args = array( | |
'post_type' => 'product', | |
'meta_query' => array( | |
'relation' => 'OR', | |
array( | |
'key' => 'color', | |
'value' => 'blue', | |
'compare' => 'NOT LIKE' | |
), |
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
add_filter( 'get_pages', 'hip_exclude_from_wp_list_pages', 10, 2 ); | |
/** | |
* Exclude pages with meta value 'hide_page_in_menus' set to 1 from wp_list_pages | |
* @param array $pages | |
* @param array $args | |
* @return array $pages | |
*/ | |
function hip_exclude_from_wp_list_pages( $pages, $args ) { | |
// Check for 'walker' key to see if this is being used by wp_list_pages() |