Expanding a function to call a plugin or show a link

Have you tried: function my_members_only_shortcode($atts, $content = null) { if ( !is_user_logged_in() ) { $content=”<p>This content is for members only. Please log in or register first.</p>” . do_shortcode(‘[do_widget “Social Login” ]’); } return $content; } That should replace the content with your message and special short code content only if the user is not logged … Read more

How WordPress Displaying Shortcode In Post Content?

Here is the solution I come up with after 30 minutes researching: function wpse_175564() { // The html goodies with shortcodes $htmlcodes=”<div class=”akismet_activate”> <div class=”aa_a”>A</div> <div onclick=”document.akismet_activate.submit();” class=”aa_button_container”> [the_shortcode id=”4″] <div class=”aa_button_border”> <div class=”aa_button”>Activate your Akismet account</div> </div> </div> <div class=”aa_description”><strong>Almost done</strong> – [the_shortcode id=”4″] activate your account and say goodbye to comment spam</div> </div>”; … Read more

Gallery with shortcode not showing

While gallery shortcode does have id arguments, it won’t do what you think. If that argument is present WP will try to look for child attachments of that post, using get_children(). It won’t take content of the post and shortcodes in it into account. If the gallery is only content of that page you could … Read more

Custom shortcode not displaying categories and correct date

Just by looking at your code I see a few places I’d investigate. 1) I don’t see any use of the $atts that come through the shortcode. Specifically the ‘tax’ and ‘post_per_page’ attributes. So try changing this; ‘tax’ => ”, to this: ‘tax_query’ => array( array( ‘taxonomy’ => ‘category’, ‘field’ => ‘slug’, ‘terms’ => ‘$atts[‘tax’]’, … Read more