Else if and Shortcodes
-
I currently have a theme set to display a Featured Image (if set)
But if no Featured Image is set, then any active widgets display instead…I want to change this to display a Featured Image if set, and if none is set to run a short code…
This is the PHP currently
<?php if (has_post_thumbnail( $post->ID ) ): ?> <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?> <img src="<?php echo $image[0]; ?>"> <?php /* Widgetized sidebar, if you have the plugin installed. */ else:if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?> <?php endif; ?> <?php endif; ?>
and this is the php to call on a shortcode…
<?php echo do_shortcode( $content ) ?>
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Else if and Shortcodes’ is closed to new replies.