How to change the default class for the widget title?

h2 and h3 are not html classes, they are html tags. That said, does not exists a default html tag for the widgets, because the format used to output widgets title is set when the sidebar is registered (look at ‘before_title’ argument). So how title is shown is theme related and sidebar related, does not … Read more

Where to put custom widget file?

If you created a custom widget, created a file by example class.my-widget.php containing the class definition of the custom widget, something like this: class my_widget extends WP_Widget { public function __construct() { //logic here } public function widget($args, $instance) { //logic here } public function form($instance) { //logic here } public function update($new_instance, $old_instance) { … Read more

Grabbing how Many Posts by Month for a Dashboard Widget

Just Went over your code and it looks fine but you are missing the code blocks for your foreach loops so: add_action(‘wp_dashboard_setup’, ‘dashboard_test’); function dashboard_test() { global $wp_meta_boxes; wp_add_dashboard_widget(‘month_dashboard’, ‘Reports Submitted for the Year’, ‘custom_test’); } function custom_test(){ global $wpdb; $years = $wpdb->get_col(“SELECT DISTINCT YEAR(post_date) FROM $wpdb->posts WHERE post_status=”publish” AND post_type=”report” ORDER BY post_date DESC”); … Read more

How to position custom dashboard widgets on side column

You’re right – it doesn’t. Neither does the wp_add_dashboard_widget function. So just use the generic add_meta_box and indicate dashboard and placement: add_action( ‘wp_dashboard_setup’, ‘my_dashboard_setup_function’ ); function my_dashboard_setup_function() { add_meta_box( ‘my_dashboard_widget’, ‘My Widget Name’, ‘my_dashboard_widget_function’, ‘dashboard’, ‘side’, ‘high’ ); } function my_dashboard_widget_function() { // widget content goes here }

Displaying info in a sidebar

You don’t need CPT’s to display custom information. You could use custom fields (you may need to enable them in the screen options at the top of the post edit window). You’d just need to include the custom fields in your loop but position them so they appear over the sidebar. Their information would be … Read more

How to call widget by widget’s id?

You can display the specified widget using the_widget. It takes the class name of the widget as an argument (not ID), so you’ll need to know that info to use it, but this allows you to use a widget outside the sidebar. If you’re looking to run some code based on the presence of a … Read more

How do I create a widget to embed the code for a sign up form, so that the sign up form appears on every page?

It’s not necessary to create a Widget, just enable the Shortcode capability to the default Text widget. Add this to the child theme’s functions.php: add_filter(‘widget_text’, ‘do_shortcode’); Then you can proceed to create a Shortcode that will render the form. See: How do I create shortcodes for my wordpress themes? The appearance of the Widget in … Read more

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