Display a text message if the shortcode is found?

Try this: <article> <div class=”entry-content”> <?php $current_user = wp_get_current_user(); if ( isset( $current_user->user_email ) ) { echo ‘<p>’ . sprintf( __( ‘%s, here is your client area’, ‘my-theme’ ), $current_user->display_name ) . ‘:</p>’; $output = do_shortcode( ‘[picu_list_collections email=”‘ . $current_user->user_email . ‘”]’ ); // the shortcode returns an empty <ul> tag, if there is no … Read more

How can I default to all WordPress roles when parameter is not included in shortcode?

Try this: function profile_counts($atts) { $atts = shortcode_atts( array( ‘metakey’ => ”, ‘metavalue’ => ”, ‘userrole’ => ”, ), $atts ); $user_ids = get_users( array( ‘meta_key’ => $atts[‘metakey’], ‘meta_value’ => $atts[‘metavalue’], ‘role__in’ => wp_parse_list( $atts[‘userrole’] ), ‘fields’ => ‘ID’, // retrieve just the IDs ‘count_total’ => false, // no need for FOUND_ROWS() ) ); return … Read more

shortcodes between square and curly brackets

To WordPress, as it parses through the content, only the tags using square brackets will be treated as short codes. The curly bracket example given would not be parsed by the WordPress core. It is possible the tag would be parsed by a plugin or theme if they are looking for hooks in the content … Read more

How do i reference the theme path in pages for images?

Use get_template_directory_uri() print get_template_directory_uri() . ‘/image.jpg’; In child themes use get_stylesheet_directory_uri() if you have replaced the image. In a shortcode this would look like this: <?php /* Plugin Name: Theme URI Shortcode */ add_shortcode(‘theme_uri’, ‘wpse_66026_theme_uri_shortcode’ ); function wpse_66026_theme_uri_shortcode( $attrs = array (), $content=”” ) { $theme_uri = is_child_theme() ? get_stylesheet_directory_uri() : get_template_directory_uri(); return trailingslashit( $theme_uri … Read more