Video Embed in Sidebar Widget with Links to Others in Category

I would create a Custom Post Type for Videos, and use in conjunction with some plugin like Simple Video Embed From there you can make a list of videos like so: <?php query_posts(‘post_type= videoss’,’showposts=20′); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class=”vidoes” > <?php echo p75GetVideo($post->ID, 400); ?> <h5><?php the_title(); ?></h5> … Read more

Calling static method in the Widget Class

Try this instead: $gloabl $myxclass; $myxclass = new Xwidget(); add_action( ‘xxx_followers’, array(&$myxclass, “cron_addB” ) ); or add_action(‘xxx_followers’, “init_xclass_and_cron”); function init_xclass_and_cron() { $myxclass = new Xwidget(); $myxclass->cron_addB(); }

Randomize widgets displayed in my sidebar [duplicate]

I couldn’t see that the answers in the possible duplicate link are using the sidebars_widgets filter, so let me add it here as another possibility: The following assumes you use dynamic_sidebar() function to display your sidebars/widgets or just anything that calls the wp_get_sidebars_widgets() function. Randomize widgets: This code snippet displays all the widgets in a … Read more

How to build widget with arrays inside arrays?

get_field_id prepare prefix for field id, within one widget instance it’s always the same. Your form fields probably look similar to these: // — $element[0] — // $field[icontxt] <input class=”widefat” id=”widget-baseid-instance-inner_elements” name=”widget-baseid[instance][inner_elements][0]” value=”%4$s”> // $field[iconlnk] <input class=”widefat” id=”widget-baseid-instance-inner_elements” name=”widget-baseid[instance][inner_elements][0]” value=”%4$s”> //$field[iconlnktrgt] <input class=”widefat” id=”widget-baseid-instance-inner_elements” name=”widget-baseid[instance][inner_elements][0]” value=”%4$s”> // — $element[1] — <input class=”widefat” id=”widget-baseid-instance-inner_elements” name=”widget-baseid[instance][inner_elements][1]” value=”%4$s”> … Read more

How to Validate Widget Input

If you are using the Widget API then declare your widget as a class which extends WP_Widget class and there you can define an upadte function where you can do your validation, the codex as a nice example of doing just that.

Determining a Widget Instance and Sidebar Location?

The widget_display_callback hook takes 3 arguments as we can see in /wp-includes/widgets.php: (line 180, WP 3.4.2) $instance = apply_filters(‘widget_display_callback’, $instance, $this, $args); So, to make a complete hook, the code is: // Priority = 10 // Arguments = 3 add_filter(‘widget_display_callback’, ‘wpse_57546_widget_display_callback’, 10, 3); // Using “$this” as an argument produces errors, // as it is … Read more

How to add a filter to all widget output

There is another thread on here that discusses a workaround. Well… the familiar php workaround when a function does not provide a “get to variable” output actually… use ob_start: http://php.net/manual/en/function.ob-start.php to just capture the output and manipulate it before sending it on its way. Leads on stackoverflow: https://stackoverflow.com/search?q=%2Bwordpress+sidebar+%2Bob-start+

What is this instance variable doing in the Widgets class

$instance holds the data stored for this widget instance as an array. You could use the same widget multiple times, and each would get different data. get_field_name() and get_field_id() returns name/id attributes for that widget. They are unique for each widget, but do not depend on the data. That’s why they do not have to … Read more

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