How do I make the title of the following widget editable?

Use This <?php class Game_Info_Widget extends WP_Widget { /** * Register widget with WordPress. */ public function __construct() { parent::__construct( ‘game_info_widget’, // Base ID ‘Game – Info’, // Name array(‘description’ => __(‘Game – Info’, ‘text_domain’),) // Args ); } /** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget … Read more

modifying title (in dashboard) for different widget instances

I believe if you add ‘title’ field to the form() (and update()) method this will be displayed in the admin interface. Traditionally this would also be used in the widget() method, but is not required. function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance[‘title’] = strip_tags($new_instance[‘title’]); return $instance; } function form( $instance ) { … Read more

Check if widget is inside sidebar with PHP

You should make the check inside the widget class, unless you don’t have a choice. The example in the codex is pretty much what you’re looking for: class cbs_map_widget extends WP_Widget{ function cbs_map_widget(){ $this->WP_Widget(‘cbsmaps’, __(‘Widget Name’), array(‘classname’ => ‘cbsmaps’, ‘description’ => __(‘whatever’))); … add_action(‘wp_enqueue_scripts’, array(&$this, ‘js’)); } function js(){ if ( is_active_widget(false, false, $this->id_base, true) … Read more

Shortcode into widget

Simply create a new widget & register it – /* Create a new Widget */ class WPSE180059_Widget extends WP_Widget { public function __construct() { $widget_ops = array( ‘classname’ => ‘widget_wpse180059’, ‘description’ => __( ‘A Custom Widget’) ); parent::__construct(‘wpse180059’, __(‘WPSE180059 Widget’), $widget_ops); } public function widget( $args, $instance ) { $title = apply_filters( ‘widget_title’, empty($instance[‘title’]) ? … Read more

How to add a text widget on the posts admin page?

You can add a “Meta Box” to the admin screen of edit post/page. WordPress have the function add_meta_box function for this job. The content inside this meta box is your choice. You can define, on which area of the edit screen will add the box, like sidebar or central area. Also you have the benefits, … Read more

How should I add a “widget” like element?

This is entirely up to you. Both approaches should do the same thing. I really do think that you having trouble with correct implementation of your first choice/approach. What you are trying to do is correct using a separate template for your slideshow and then calling it with get_template_part(). The problem it seems is your … Read more

Can’t save widget

Thank you all. I just took code from codex, I’ve changed id footerBoxOne to footer-box-1 for all four widgets, and it’s working now. I guess uppercase chars were the problem

How to allow editing of text in sidebar?

There are two ways to see it: Sidebar as a general area of site layout Sidebar as container, filled with WordPress widgets Or maybe combination of the two. The prime reason to use WordPress widgets is that they provide roughly consistent experience, can be easily used multiple times, and can be enhanced with related functionality … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)