fix: conditionally render social media links in footer
Updated the footer to conditionally display social media icons based on theme settings. This prevents empty links from appearing when no URL is set, improving UX and avoiding potential navigation issues.
This commit is contained in:
parent
142e96e22a
commit
b60e6c8c33
1 changed files with 9 additions and 3 deletions
12
footer.php
12
footer.php
|
@ -13,9 +13,15 @@
|
|||
?>
|
||||
</div>
|
||||
<div class="social-media mt-3">
|
||||
<a href="<?php echo get_theme_mod('footer_facebook_link', '#'); ?>" class="mx-2"><img src="<?php echo get_template_directory_uri(); ?>/facebook-icon.png" alt="Facebook"></a>
|
||||
<a href="<?php echo get_theme_mod('footer_twitter_link', '#'); ?>" class="mx-2"><img src="<?php echo get_template_directory_uri(); ?>/twitter-icon.png" alt="Twitter"></a>
|
||||
<a href="<?php echo get_theme_mod('footer_linkedin_link', '#'); ?>" class="mx-2"><img src="<?php echo get_template_directory_uri(); ?>/linkedin-icon.png" alt="LinkedIn"></a>
|
||||
<?php if (get_theme_mod('footer_facebook_link', '#')) : ?>
|
||||
<a href="<?php echo get_theme_mod('footer_facebook_link', '#'); ?>" class="mx-2"><img src="<?php echo get_template_directory_uri(); ?>/facebook-icon.png" alt="Facebook"></a>
|
||||
<?php endif;
|
||||
if (get_theme_mod('footer_twitter_link', '#')) : ?>
|
||||
<a href="<?php echo get_theme_mod('footer_twitter_link', '#'); ?>" class="mx-2"><img src="<?php echo get_template_directory_uri(); ?>/twitter-icon.png" alt="Twitter"></a>
|
||||
<?php endif;
|
||||
if (get_theme_mod('footer_linkedin_link', '#')) : ?>
|
||||
<a href="<?php echo get_theme_mod('footer_linkedin_link', '#'); ?>" class="mx-2"><img src="<?php echo get_template_directory_uri(); ?>/linkedin-icon.png" alt="LinkedIn"></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
Loading…
Reference in a new issue