Moody Shortcodes

A simple API to do the shortcodes on certain conditions.

Author:Nashwan Doaqan (profile at wordpress.org)
WordPress version required:2.5
WordPress version tested:3.7.36
Plugin version:0.1
Added to WordPress repository:02-12-2013
Last updated:02-12-2013
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
Rating, %:0
Rated by:0
Plugin URI:https://github.com/nash-ye/WP-Moody-Shortcode...
Total downloads:773
plugin download
Click to start download

Important Notes:

  1. This plugin is for developers, not general users.
  2. This plugin doesn’t have a GUI ( Admin Settings Page ).

Basic Examples

You can use this plugin in many ways depending on your needs, this examples only for learning purposes:

// Register the "test-1" shortcode, Works only in the administrators posts or outside the loop. Moody_Shortcodes_Manager::register( 'test-1', function() {      if ( in_the_loop() ) {          $post_author = get_post_field( 'post_author', get_post() );          if ( ! user_can( $post_author, 'administrator' ) ) {             return false;          } // end if      } // dnd if      return true;  }, 'my_test_shortcode' );    // Register the "test-2" shortcode, Works only in pages or outside the loop. Moody_Shortcodes_Manager::register( 'test-2', function() {     return ( ! in_the_loop() XOR get_post_type() === 'page' ); }, 'my_test_shortcode' );    // Register the "test-3" shortcode, Works only when bbPress plugin is activated. Moody_Shortcodes_Manager::register( 'test-3', function() {     return function_exists( 'is_bbpress' ); }, 'my_test_shortcode' ); 

Contributing

If you love this plugin star/fork it on the GitHub Repository.


ChangeLog