Created
May 11, 2022 17:13
-
-
Save carlaizumibamford/85e789d9d8560b4ecefc93dcc654596c to your computer and use it in GitHub Desktop.
Creating A Custom Wordpress Widget Plugin Vol 6
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
public function widget( $args, $instance ) { | |
extract( $args ); | |
$title = isset( $instance['title'] ) ? apply_filters( 'widget_title', $instance['title'] ) : ''; | |
$text = isset( $instance['text'] ) ? $instance['text'] : ''; | |
$textarea = isset( $instance['textarea'] ) ?$instance['textarea'] : ''; | |
$select = isset( $instance['select'] ) ? $instance['select'] : ''; | |
$checkbox = ! empty( $instance['checkbox'] ) ? $instance['checkbox'] : false; | |
echo $before_widget; | |
echo '<div class="widget-text wp_widget_plugin_box">'; | |
if ( $title ) { | |
echo $before_title . $title . $after_title; | |
} | |
if ( $text ) { | |
echo '<p>' . $text . '</p>'; | |
} | |
if ( $textarea ) { | |
echo '<p>' . $textarea . '</p>'; | |
} | |
if ( $select ) { | |
echo '<p>' . $select . '</p>'; | |
} | |
if ( $checkbox ) { | |
echo '<p>Something awesome</p>'; | |
} | |
echo '</div>'; | |
echo $after_widget; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment