Code Snippets

Sidebar With Fallback Message

Standard WordPress Sidebar function. Displays the sidebar if it has widgets assigned to it. If not, it displays a message.

Simple example of conditional logic applied to a WordPress sidebar. Add the following code snippet to your theme functions.php file

<?php if(dynamic_sidebar('footer_left' ): )?>
	<?php else: ?>
	<p>This message will display if there's no content in the sidebar.</p>
<?php endif; ?>

Hire a WordPress Expert

Get hourly and project based theme customization, theme tweaks, and development help from an experienced Kelowna WordPress developer.  We’ve been building WordPress websites full-time for over a decade. We can help you.