Add function to Simple Twitter Connect to not Tweet pages

Even better answer that doesn’t involve changing the plugin: remove_action(‘transition_post_status’,’stc_publish_auto_check’,10,3); add_action(‘transition_post_status’,’my_custom_publish_rules’,10,3); function my_custom_publish_rules($new, $old, $post) { if ($post->post_type == ‘page’) return; else stc_publish_auto_check($new, $old, $post); } Put it in a theme’s functions.php. Side note: Whenever you’re dealing with a function called by an action or filter hook, then you can easily wrap the call in … Read more

Show top commenters without using a plugin

$output .= “<li>”.(($result->comment_author_url) ? “<a href=””.$result->comment_author_url.””>” : “”).$result->comment_author.(($result->comment_author_url) ? “</a>” : “”).” (“.$result->comments_count.”)</li>”; edit: to show the avatar before the name: $output .= “<li>”.get_avatar($result->comment_author_email, 45).’ ‘.(($result->comment_author_url) ? “<a href=””.$result->comment_author_url.””>” : “”).$result->comment_author.(($result->comment_author_url) ? “</a>” : “”).” (“.$result->comments_count.”)</li>”;

Default Gallery Edit/Template Editable?

Put this code in your functions.php and check. function custom_gallery( $output, $attr ){ global $post, $wp_locale; static $instance = 0; $instance++; // We’re trusting author input, so let’s at least make sure it looks like a valid orderby statement if ( isset( $attr[‘orderby’] ) ) { $attr[‘orderby’] = sanitize_sql_orderby( $attr[‘orderby’] ); if ( !$attr[‘orderby’] ) … Read more

Need to add class=”lightbox” for every single post image

One way you can accomplish it is this way: functions.php add_action( ‘wp_enqueue_scripts’, ‘your_lightbox_callback’ ); function your_lightbox_callback(){ if( is_single() /* or whatever here */ ) { wp_register_script( ‘your-lightbox’, get_bloginfo( ‘template_url’ ) . ‘/lightbox-class.js’ ); wp_enqueue_script( ‘your-lightbox’ ); } } lightbox-class.js var $j = jQuery.noConflict(); $j( document ).ready( function() { $j( ‘#whereveryourpostsare img’ ).addClass( ‘lightbox’ ); } … Read more

How do I permanently Disable Attachment Post URL

The form for the ‘From Url’ tab seems to be pretty much hard-coded, so I don’t think there is away of removing the ‘Link Image To’ field. However, for the Media Library tab you can remove the link field, with the following: add_filter(‘attachment_fields_to_edit’, ‘my_attachment_fields_edit’, 10, 2); function my_attachment_fields_edit($form_fields,$post){ //Set attachment link to none and hide … Read more

Short_title character problem

Use mb_strlen(), not strlen(). The same with mb_substr() and substr(): Your title contains multi-byte characters, but strlen() and substr() do not work on characters, they work on single bytes. For a improved function to shorten strings see this answer.