Last active
September 18, 2024 12:56
-
-
Save topleague/61e2ff52146354e8cdbff1e7b76d09ce to your computer and use it in GitHub Desktop.
Adding a Subtitle to Genesis Featured CPT Widget Plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//* Create a field for subtitle | |
<p> | |
<label for="<?php echo esc_attr( $this->get_field_id( 'subtitle' ) ); ?>"> | |
<?php _e( 'Subtitle:', 'featured-custom-post-type-widget-for-genesis' ); ?> | |
</label> | |
<input type="text" id="<?php echo esc_attr( $this->get_field_id( 'subtitle' ) ); ?>" | |
name="<?php echo esc_attr( $this->get_field_name( 'subtitle' ) ); ?>" | |
value="<?php echo esc_attr( $instance['subtitle'] ); ?>" | |
class="widefat" /> | |
</p> | |
//* Save the subtitle input | |
$new_instance['subtitle'] = strip_tags( $new_instance['subtitle'] ); | |
//* Output the subtitle | |
if ( ! empty( $instance['subtitle'] ) ) { | |
echo '<p class="widget-subtitle blog-subtitle">' . esc_html( $instance['subtitle'] ) . '</p>'; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment