How to add Ajax to the default widget calendar to support next/previous months loading?

Interesting task indeed. Here’s what I would do: Create my own plugin with a widget. You can always use plugin boilerplate or widget boilerplate as starting points. My widget would look like the default calendar, except it would also have the ‘prev”https://wordpress.stackexchange.com/”next’ links, as you mentioned. I would then copy-paste and adjust the get_calendar() function … Read more

accessing wordpress serialized data outside wp

Use PHP’s unserialize function: <?php $data=”a:2:{i:0;s:12:”Sample array”;i:1;a:2:{i:0;s:5:”Apple”;i:1;s:6:”Orange”;}}”; $unserialized = unserialize($data); echo ‘<pre>’; print_r($unserialized); echo ‘</pre>’; ?> Result: Array ( [0] => Sample array [1] => Array ( [0] => Apple [1] => Orange ) ) Got the sample data over at unserialize.com, a handy little site if you want to quickly check what’s inside that … Read more

Creating a dynamic class name in my custom widget

Your problem is due to your trying to include a file over the http protocol. That kind of include is disabled on your server– hence the message saying pretty much just that. Use get_template_directory instead, which will give you a filesystem path. If that does not solve it, post your code in more context. Disjointed … Read more

How to change widget’s form color in admin?

Register/enqueue an admin stylesheet function my_admin_theme_style() { wp_enqueue_style(‘my-admin-theme’, get_template_directory_uri().’/admin-style.css’); } add_action(‘admin_enqueue_scripts’, ‘my_admin_theme_style’); Then add rules of the form #widget-list div[id*=”_archives-“], div[id*=”_archives-“] { background:red; } Consider that proof of concept. I will leave it up to you to target the precise elements you want.

Link a widget or find the php that creates the widgets

If the widget is part of the wordpress core, you can see its source in wp-includes/default-widgets.php. If it came with a theme or plugin, you can find the code there. Sometimes widgets will be in an obviously-named widgets.php, but other times you’ll have to hunt for them. At some point, each widget has to be … Read more

how can i display all youtube videos from a users youtube account

You can use YouTube developer API. Example how to get recent videos below: $data = wp_remote_get(‘http://gdata.youtube.com/feeds/api/users/<USERNAME>/uploads/?start-index=1&max-results=40’); $response = new SimpleXMLElement($data[‘body’]); foreach ($response->entry as $entry): $vid_id = ”; if ( preg_match(‘#videos/([^/]+)$#’, $entry->id, $matches) ) { $vid_id = $matches[1]; } if ( $vid_id ): ?> <a href=”http://youtube.com/watch?v=<?php echo $vid_id; ?>”> <img src=”http://i.ytimg.com/vi/<?php echo $vid_id; ?>/1.jpg” width=”220″ height=”130″ … Read more

how to show only particular category post in archive widgets

add_filter( ‘getarchives_join’ , ‘getarchives_join_filter’); function getarchives_join_filter( $join ) { global $wpdb; return $join . ” INNER JOIN {$wpdb->term_relationships} tr ON ($wpdb->posts.ID = tr.object_id) INNER JOIN {$wpdb->term_taxonomy} tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id)”; } add_filter( ‘getarchives_where’ , ‘getarchives_where_filter’); function getarchives_where_filter( $where ) { global $wpdb; return $where . ” AND tt.taxonomy = ‘category’ AND tt.term_id=’blog category id’ … Read more

Dynamically creating multiple widgets from Mustache templates

How do I register multiple widgets with a single class definition? You don’t. Modern class based Widget API in WP assumes that one class corresponds to one widget. Note that you can still have intermediary subclasses – (extend WP_Widget, then extend it once more) but what you register in the end is still one widget … Read more

widget not displayed

you can use dynamic_sidebar() function to display a sidebar in a page. dynamic_sidebar(‘Name or ID of dynamic sidebar.’)

Adding a single text input field to a custom Dashboard widget

You need a set of functions to : process datas sanitize options allow datas to be updated output the form I like to proceed this way. I set also a function to grab datas so I can call them the simpliest way : add_action(‘wp_dashboard_setup’, ‘wpse_106458_add_widget’); function wpse_106458_add_widget() { $title = my_function_get_options(); $title = $title[‘title’]; wp_add_dashboard_widget(‘widget_id’, … Read more

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