Widget Development – Displaying dropdown content

$instance[‘page_id’] should be the post ID of the selected post. So … function widget($args, $instance) { $post = get_post( $instance[‘page_id’] ); echo $post->post_content; // you should add the common filters here var_dump( $post ); // more data } … should be a good start. To save the last value in the configuration form use selected(): … Read more

Call sidebar from a template

Impossible with get_sidebar(). From that function’s body: function get_sidebar( $name = null ) { do_action( ‘get_sidebar’, $name ); $templates = array(); if ( isset($name) ) $templates[] = “sidebar-{$name}.php”; $templates[] = ‘sidebar.php’; So if you pass a $name or any other custom value to the function, they will be set between two fixed strings. You can … Read more

user definable sidebar per page

There’s a brute force method you can use. When you register your sidebar, you give it an ID and a name, then you use that ID and name on the sidebar template to display it. What if you appended the ID of the page to that identifier? So instead of ‘mainsidebar’ you had ‘mainsidebar’.$post->ID? Step … Read more

Options page for widget

Your widget is part of a plugin (per the first sentence of the question), so what you are really talking about is making a plugin administration page, which you would do with add_menu_page, add_submenu_page, or one of the more specialize menu page functions. That is the nutshell version of the answer. There are a lot … Read more

Neaten content — different widget or CSS change?

You could add this to your CSS: div.textwidget { max-width: 250px; } You would probably want to make sure that’s above your media query rules so that it doesn’t affect the formatting of your page on smaller screens. I used Chrome’s developer console to find out how wide the text inputs are and to find … Read more

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