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 | |
// Redirect to homepage after logout | |
add_action('wp_logout','go_home'); | |
function go_home(){ | |
wp_redirect( home_url() ); | |
exit(); | |
} | |
// Customize the toolbar for non admins | |
function change_toolbar($wp_toolbar) { |
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
// limit the comments to 1.000 characters | |
jQuery(function($) { | |
// configure | |
var comment_input = $( '#commentform textarea#comment' ); | |
var submit_button = $( '#commentform #submit' ); | |
var comment_limit_chars = 1000; | |
// stop editing here | |
// display how many characters are left | |
$( '<div class="comment_limit_info"><span>' + comment_limit_chars + '</span></div>' ).insertAfter( comment_input ); |
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 | |
//modify the excerpt lenght (Wordpress default is 55 words) | |
add_filter('excerpt_length', 'my_excerpt_length'); | |
function my_excerpt_length($length) { | |
if (is_archive()) { | |
return 55; // This is the number of words in archive pages (e.g. category overview). | |
} else { | |
return 55; // This is the number of words in all other excerpts | |
} | |
} |
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 | |
// Changing excerpt more | |
add_filter('excerpt_more', 'new_excerpt_more'); | |
function new_excerpt_more($more) { | |
return '...<br /><a class="clear excerptmore button" href="'.get_permalink().'">'. __('Continue reading' , PRiNZ_DOMAIN).' »</a><br /><br />'; | |
} | |
?> |
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: (#90328) Login with E-Mail address */ | |
function login_with_email_address( $username ) { | |
$user = get_user_by( 'email', $username ); | |
if ( !empty( $user->user_login ) ) | |
$username = $user->user_login; | |
return $username; | |
} | |
add_action( 'wp_authenticate','login_with_email_address' ); |
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
// Link all Post Thumbnails to their Posts | |
add_filter( 'post_thumbnail_html', 'my_post_image_html', 10, 3 ); | |
function my_post_image_html( $html, $post_id, $post_image_id ) { | |
$html = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_post_field( 'post_title', $post_id ) ) . '">' . $html . '</a>'; | |
return $html; | |
} |
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 $custom_query = new WP_Query('cat=-9'); // exclude category 9 | |
while($custom_query->have_posts()) : $custom_query->the_post(); ?> | |
<div <?php post_class(); ?> id="post-<?php the_ID(); ?>"> | |
<h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1> | |
<?php the_content(); ?> | |
</div> | |
<?php endwhile; ?> | |
<?php wp_reset_postdata(); // reset the query ?> |
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 "first" and "last" CSS classes to dynamic sidebar widgets. Also adds numeric index class for each widget (widget-1, widget-2, etc.) | |
*/ | |
function widget_first_last_classes($params) { | |
global $my_widget_num; // Global a counter array | |
$this_id = $params[0]['id']; // Get the id for the current sidebar we're processing | |
$arr_registered_widgets = wp_get_sidebars_widgets(); // Get an array of ALL registered widgets | |
if(!$my_widget_num) {// If the counter array doesn't exist, create it | |
$my_widget_num = array(); |
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 display_custom_image_sizes( $sizes ) { | |
global $_wp_additional_image_sizes; | |
if ( empty($_wp_additional_image_sizes) ) | |
return $sizes; | |
foreach ( $_wp_additional_image_sizes as $id => $data ) { | |
if ( !isset($sizes[$id]) ) | |
$sizes[$id] = ucfirst( str_replace( '-', ' ', $id ) ); | |
} | |
return $sizes; |
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 my_custom_login_logo() { | |
echo '<style type="text/css"> | |
h1 a { background-image:url('.get_bloginfo('template_directory').'/images/custom-login-logo.gif) !important; } | |
</style>'; | |
} | |
add_action('login_head', 'my_custom_login_logo'); | |
?> |
NewerOlder