Passing values between enclosing and enclosed shortcodes

You can try this plugin: /** * Plugin Name: My Boxes Shortcode * Author: birgire * Author URI: http://wordpress.stackexchange.com/a/121423/26350 */ add_action( ‘plugins_loaded’, array( ‘My_Boxes_Shortcode’, ‘get_instance’ ) ); if( ! class_exists( ‘My_Boxes_Shortcode’ ) ) { class My_Boxes_Shortcode { static private $instance = NULL; static public function get_instance() { if ( NULL === self::$instance ) self::$instance = … Read more

Get Posts by IDs (optionally)

It looks like WordPress doesn’t ignore empty post__in param. So you’ll have to do this yourself like this… $ids=”1,2,3″; if ( $ids ) { $arr = explode(“,” ,$ids); $args = array( ‘posts_per_page’ => $number, ‘post__in’ => $arr ); } else { $args = array( ‘posts_per_page’ => $number ); }

How to List Custom Post Type Titles Based on Theirs Taxonomy Terms Inside a Nested Loop

Retrieval of multiple posts in WordPress is almost always handled by WP_Query class (or get_posts() function that wraps it). There is quite a lot of documentation and information to it, but to narrowing it down to your specific case you will need to: set up posts loop for each term pass as arguments to each … Read more

The Events Calendar Plugin – List View Background Colour Issue [closed]

If I understand you correctly, you can add this code to #tribe-events-content.tribe-events-list in your stylesheet like so: #tribe-events-content.tribe-events-list { margin-bottom: 60px; background: #FFFFFF; /* ADD A BACKGROUND COLOR HERE */ } That will add a background to the Upcoming Events section so that the text is more easily readable. Here’s a screenshot of the change.

How can I get plugin meta data without knowing the plugin folder?

If you know a function or class of the plugin’s main file, you can use the Reflection API. Example with my plugin T5 Taxonomy Location add_action( ‘plugins_loaded’, function() { $class=”T5_Taxonomy_Location”; if ( ! class_exists( $class ) ) return; add_action( ‘admin_footer’, function() use ( $class ) { $reflection = new ReflectionClass( $class ); $file = $reflection->getFileName(); … Read more

Redirect returning users to a certain page?

function redirect_user() { if ( is_user_logged_in() ) { wp_redirect( ‘http://yoursite.com/page/’ ); exit; } } add_action( ‘init’, ‘redirect_user’ ); This will redirect the user to the page of your choice if they are logged in. It might be necessary to add a conditional that checks to make sure the user isn’t already on that page, to … Read more