Add more widget areas to a theme

You have to add this code in the functions.php file: /** * Register new sidebar * */ function new_sidebar_widget_init() { register_sidebar( array( ‘name’ => ‘new-sidebar’, ‘id’ => ‘new-sidebar’, ‘before_widget’ => ‘<div id=”new-sidebar”>’, ‘after_widget’ => ‘</div>’, ‘before_title’ => ”, ‘after_title’ => ”, ) ); } add_action( ‘widgets_init’, ‘new_sidebar_widget_init’ ); and then call the sidebar from a … Read more

Right way to update widget on dynamic new input field

Ok, i have solvd it, there is my updated code <?php /** * Adds TMD_Radio_Player. */ class TMD_Radio_Player extends WP_Widget { /** * Register widget with WordPress. */ function __construct() { parent::__construct( ‘tmd_radio_player’, // Base ID __(‘TMD Radio Player’, ‘text_domain’), // Name array( ‘description’ => __( ‘Menampilkan radio player’, ‘text_domain’ ), ) // Args ); … Read more

Extending the WP_Widget_Text class

Think about it, why would WordPress do anything just because you have defined additional class? It’s not magic (neither magical magic or code driven magic). The text widget doesn’t appear simply because class exists. When WordPress loads it runs wp_widgets_init(), which executes register_widget(‘WP_Widget_Text’). So technically you cannot tell it to use different class. What you … Read more

Get post values of form created by widget in sidebar

Your form needs to have method=”post” and action=”someScript.php” defined. It will send the post variables to wherever you deifine in your action=”” <form method=”post” action=”someScript.php” > <p> <label for=”db_sub_name”>Name</label> <input type=”text” name=”db_sub_name” id=”db_sub_name” value=”” placeholder=”Enter your Name”> </p> <p> <label for=”db_sub_name”>Email</label> <input type=”text” name=”db_sub_email” id=”db_sub_email” value=”” placeholder=”Enter your Email”> </p> <p> <input style=”float:right;” type=”submit” /> … Read more