List.js inside WordPress widget
List.js inside WordPress widget
List.js inside WordPress widget
$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
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
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
Widget Disappearing in IE
My blog has a design issue.
I am not sure what you mean by “the actual name”. If you need the class name, look in the source of the theme for extends WP_Widget. Other widget information is stored in the $wpdb->options table under keys starting with widget_. Once you find that you can use get_option( ‘widget_name’ ); to get information about … Read more
I’m still eager to hear of an action that applies to this use case, but here’s a more brute-force approach, if nothing else turns up: // within My_Widget class definition private static $metaboxes_added = false; // to ensure we don’t add them more than once // inside My_Widget class constructor add_action( ‘init’, array( $this, ‘add_metaboxes’ … Read more
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
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