Widget settings disappear after refreshing page
Changing the include_once within form() to require solved the bug.
Changing the include_once within form() to require solved the bug.
You can use the function is_active_widget . E.g.: function check_widget() { if( is_active_widget( ”, ”, ‘search’ ) ) { // check if search widget is used wp_enqueue_script(‘my-script’); } } add_action( ‘init’, ‘check_widget’ ); To load the script in the page where the widget is loaded only, you will have to add the is_active_widget() code, in … Read more
This CSS will make your grey text in some else you want: .widget_posts_wrap .latest-posts .col-md-12 a span {color:#your-hex-code !Important;} This is for subtitles in this widget where you have latest post. And this is for titles: .widget_posts_wrap .latest-posts .col-md-12 h3 a {color: #your-hex-code !important;} Also just note to change #your-hex-code part with actual hex code. … Read more
Your widget is okay but problem is customizer do not show sidebar option if there is no sidebar is called on current viewing page. You did register the two siderbars but did not call them any where in the template of page your are seeing in customizer. Use dynamic_sidebar function and call your sidebar somewhere … Read more
I think ajax request should point to the actual WordPress ajax handler. You can pass the variable by localising the script: $js_object = [ ‘ajaxUrl’ => admin_url(‘admin-ajax.php’) ]; wp_register_script(‘my-script’, ‘http://url’); wp_localize_script(‘my-script’, ‘pluginObject’, $js_object); wp_enqueue_script(‘my-script’); Register the ajax request into ajax hook: function widget_ajax_request() { // your stuff } add_action(‘wp_ajax_my_action’, ‘widget_ajax_request’); add_action(‘wp_ajax_nopriv_my_action’, ‘widget_ajax_request’); And your JS … Read more
As I’m not able to comment yet, I can only answer. But I’ve got questions. How does the widget get used? Where is it called? is the ORIGINAL script you posted above in a file like /theme/twitter-widget.php? Or is it in your functions.php script for the theme? Something wasn’t configured to run YOUR widget, and … Read more
Not a lot to go on here! I’d suggest registering 2 different sidebars – one for the category 3 posts and one for the rest. Then you can add you widgets and modify them as required.
I was able to resolve the problem. After looking throu the theme/plugin code i noticed that it was altered before and the false links were hardcoded into it.
I’ve written custom functions for queries. <?php /** * Column Content (min:2 – max:3 column) * * @since 1.0.0 * @return void */ if ( ! defined( ‘ABSPATH’ ) ) { exit; } add_action( ‘widgets_init’, function(){ register_widget( ‘Hw_Column_Widget’ ); }); class Hw_Column_Widget extends WP_Widget { /** * Sets up the widgets name etc */ public … Read more
An array will be serialized when saved to the DB. If you want to update a key to the array, you need to Fetch the option first Apply modifications Update the option with the updated array values so in your example if you fetch the option, you should get a multidimensional array where you have … Read more