Thursday, May 24, 2012

TinyMCE Editor Implementation Plus








Just finished after many hours of creating a spacer button (icon) for theme : "advanced", which shows all buttons (icons).

With some JQuery magic you can accomplish this. Here's the pseudo code:

  1. Remove all the necessary classes and add a new class for the tags that contain the image for you spacer (transparent) gif with specific width and height of your choosing. And remember to deactivate the spacer button.
  2. I used this to right align my company logo for contact information
  3. theme_advanced_buttons5 : removeformat, iespell, spacer, mycompanylogo


I can now say that I can support or implement the awesome TinyMCE Editor! For services contact me.

Tuesday, May 22, 2012

How to Disable / Stop RSS Feeds in WordPress - SEO Friendly Way




How to Disable / Stop RSS Feeds in WordPress
 


Anyone who uses Wordpress may want to stop RSS feeds to stop spammers and scammers.  The common approach is the following function added to functions.php : 

function fb_disable_feed() { 
  wp_die( __(‘No feed available,please visit our homepage!’) );
}
add_action(‘do_feed’, ‘fb_disable_feed’, 1);
add_action(‘do_feed_rdf’, ‘fb_disable_feed’, 1);
add_action(‘do_feed_rss’, ‘fb_disable_feed’, 1);
add_action(‘do_feed_rss2, ‘fb_disable_feed’, 1);
add_action(‘do_feed_atom’, ‘fb_disable_feed’, 1);

What's wrong this function?
Well, it returns a HTTP Status code of 500. 

500 (Internal server error)The server encountered an error and can't fulfill the request.


Not terribly SEO friendly. Too many 500 errors call into question the reliability of that site. Google doesn’t want to send users to a site that ultimately times out and doesn’t load.

This is a better written code snippet and will redirect to homepage.


// Remove feed links from the header
add_action( 'wp_head', 'custom_remove_feed_links', 1 );
function custom_remove_feed_links() {
// Remove feed links from the header
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'feed_links_extra', 3 );
}

// Redirect all feed requests to the homepage
foreach ( array( 'rdf', 'rss', 'rss2', 'atom' ) as $feed ) {
add_action( 'do_feed_' . $feed, 'custom_redirect_feeds', 1 );
}
unset( $feed );
function custom_redirect_feeds() {
wp_redirect( home_url(), 302 );
exit();
}

// Delete feed rules
add_action( 'init', 'custom_kill_feed_endpoint', 99 );
function custom_kill_feed_endpoint() {
global $wp_rewrite;
$wp_rewrite->feeds = array();
flush_rewrite_rules(); // Delete this line after running once
}