Articles of widgets

How to not display subcategories in Recent Posts widget area?

I’m relatively new to WordPress, and coding in general. I am trying to edit theme-specific recent posts widget to display only posts within a certain category. Currently, the theme will display recent posts with video thumbnails in a category, but it will also include recent posts within any subcategories of that category. I do not […]

How to create a widget like this?

I have a problem with WordPress widgets. I want to create a widget like in the images. I know how to create a widget but I don’t know query and show the results as in the image. Explain: We get 10 posts from a category, then show it as title 1 is the first post […]

Register_Sidebar overwriting itself and doesn't exist in global $wp_registered_sidebars;

I have Dynamic sidebars that are generated based on terms of a taxonomy that were created. CLASS EXCERPT: public function __construct() { add_action(‘widgets_init’, array($this, ‘checkForActiveSidebarAndMenu’)); } public function checkForActiveSidebarAndMenu() { //global $wp_registered_sidebars; //print_r($wp_registered_sidebars); $terms = get_terms(array(‘taxonomy’=>’minisite’,’hide_empty’=>false)); print_r($terms); foreach($terms as $term) { $this->registerSidebars($term->term_id); //$this->registerMenu($term->term_id); update_term_meta($term->term_id, ‘sidebar_active’, ‘1’); //update_term_meta($term->term_id, ‘menu_active’, ‘1’); } } public function registerSidebars($mini_site_id) { […]

How to add Shortcode (font awesome) in widget title?

I want to show font awesome icon (installed) on the left side of the WordPress widget title. I found this shortcode that should do the work. add_filter( ‘widget_title’, ‘do_shortcode’ ); add_shortcode( ‘icon’, ‘shortcode_fa’ ); function shortcode_fa($attr, $content ) { return ‘<i class=”fa fa-‘. $content . ‘”></i>’; } After adding this in functions.php, I should be […]

Post Query not working

I have made a widget in my functions.php, like this: class Categories_Widget extends WP_Widget { function __construct() { parent::__construct( ‘categories_widget’, // Base ID (‘Categoriën tonen’), // Name array( ‘description’ => ( ‘Toon categoriën’ ), ) // Args ); } function widget($args, $instance) { extract($args, EXTR_SKIP); echo $before_widget; //echo “<h1>This is my new widget!</h1>”; include ‘inc/categories.php’; […]

Modifying recent post widget to include icons for post titles

I have downloaded a plugin from the wordpress repository which allows adding font icons to the titles of posts, you can select a different icon for individual posts according to preference. Now, the plugin displays the icon just fine in the post archive template and single post template, but does not show the featured icon […]

flush_widget_cache is deprecated. Which method should i use instead?

The reviewer of my theme told me that flush_widget_cache() which I have used in one of my widgets is deprecated since version 4.4. I have searched for this method on codex but there is only a description that this function is deprecated and that’s it. Can anybody tell me that which method should i use […]

get_term_meta returns false in widget

I am stuck and hope you can help me out. I am working on a sidebar widget that shows WooCommerce Shops (I use the Plugin Woocommerce Product Vendors, the official Woocommerce Plugin for multiple user shops). Those shops are basically Terms within the wcpv_product_vendors Taxonomy. Now when I open a shop (-> opening the single […]

Shortcode inside text widget do not call enqueue style

I did a plugin who call enqueue style inside a shortcode. But when i add my shortcode in a text widget the enqueue style are not included en the page. wp_enqueue_style(‘css-rfnb’, RFNB_PLUGIN_DIR_URL . ‘css/rfnb.css’);

Add element to widgetpage

I am trying to figure out if it is possible to add elements to the widgetpage in WordPress’ dashboard without editing the widgets.php core file. Is there a WordPress function or something else (maybe even a jQuery solution) that will get this done? If I google this the only results are about widget area’s but […]