Nested WordPress Shortcodes

Have you tried calling a shortcode within another shortcode and discovered it doesn’t work?

WordPress makes nested shortcodes possible but requires each shortcode to actively participate by calling do_shortcode() when exiting.

For a recent client’s needs, I created a simple shortcode in the child theme’s functions.php that allowed to them to display different content to logged-in and non-logged-in users. I needed to wrap that around Events Manager‘s event_list shortcode to display different calendars in the same widget based on the user’s logged-in status.

Because the “outer” shortcode was my own, I could modify it without fear that a plugin update would overwrite the change.

Here’s the modification in the non-logged-in user’s version. Note the use of do_shortcode wrapped around the $content in the return line.
Continue reading “Nested WordPress Shortcodes”

Google says your site isn’t mobile friendly?

With Google placing a greater emphasis on mobile compatibility in search placement, many businesses are in a panic over how to make their websites mobile friendly. What does that even mean? How do we get there from here? Should we do just the minimum or is now the time for a broader site re-design?

Being mobile friendly used to mean having a separate website just for mobile and making your site smart enough to redirect the user to this .mobi or other mobile site when detecting their device type or screen size. Today, mobile friendly more often means having one site that is “responsive” to detected screen sizes and device types so that it presents the same content in the manner best suited to the user’s screen size and interface method (mouse and keyboard v. touch being the prime example). Through the power of Cascading Stylesheets, it isn’t too difficult to make a site responsive. However, a little extra work goes a long ways in making the site truly usable for differing screen sizes and device types.
Continue reading “Google says your site isn’t mobile friendly?”