New answers tagged

0

I have faced the same problem, what I have noted is, professionally it is not advised to use plugin or functions.php for executing php in widgets, that's why such as now that functions.php technic don't work. It is advised to construct your own widget, this is what I'm going to do.


0

Your terminology is a little off. Search implies providing a search word of phrase and receiving matched when it is found in content. What you describe is commonly called filters or facets (sometimes faceted search). Implementing it would depend on your exact data architecture. You might use custom taxonomies, but really there aren't details in your ...


0

You need to setup postdata in order to set the $post global in order to make template tags available for this to work foreach ( $myposts as $post ) { setup_postdata( $post ); get_template_part( 'content' ); } wp_reset_postdata();


0

As an addition to your scripts I wrote the script which hides sidebars from the dropdown list (I couldn't find this anywhere). I made some reverse engineering of the original widgets.js Wordpress code to write this. The complete solution for allowing to drag & drop only to specified sidebars and to filter the dropdown list (you just need to put this in ...


3

You need to add the widget to a plugin and submit the plugin to the plugin directory.


0

When you hit save, open your console and log any errors. Also tick 'Preserve Log' so you can see any errors when you are changing page. Perhaps your theme is conflicting with a plugin or with wordpress.


0

that buttons are known as Quicktags, Go to Wordpress docs and search for Quicktags_API and you will get lots of default quicktags and their usages with example.


1

I am adding another answer to answer this question:- How to exclude certain widget from showing up on home/front page? WordPress has an internal function _get_widget_id_base() I am not sure how safe to use it. But this is the method which WordPress uses to get widget ID base by using widget ID instead of strpos() and strncmp(). Example:- ...


1

To append text to the end of the titles in that widget and nothing more i.e. does not matter the URL, you can just use some CSS. <li> <a class="my-folder-categories">Category 1</a> </li> a.my-folder-categories-folder:after {content:" folder"; This will effectivly make the text appear as so: category 1 folder Be sure to add ...


0

I've found the exact solution to my question here: http://wordpress.stackexchange.com/a/17687/92505 Here's the exact code I used after some modification to make it work on my situation. Add the following code to functions.php where 'sidebar-1' is your sidebar ID. 'recent-posts' is the name of the widget your want yo hide. 12 is the length of the string ...


0

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 ...


-1

function wpbootstrap_checksidebars_widgets($sidebars_widgets) { return $sidebars_widgets; } add_filter('sidebars_widgets','wpbootstrap_checksidebars_widgets' ); //Now user can add custom widget areas function custom_widget_areas_init() { register_sidebar( array( 'name' => 'Front Page Widget Area', 'id' => 'frontpage-widgets', ...


1

You're not echoing the wrapping divs. The register_sidebar only defines the div, but doesn't render it. You need to extract the texts and echo them, like this: public function widget( $args, $instance ) { extract( $args ); $title = apply_filters( 'widget_title', $instance['title'] ); echo $before_widget; if ( $title ) { ...


0

To remove your search box as you want, the easiest way is to use CSS: #sidebar > form:first-of-type{display:none;} Here you are using pseudo selector that will remove only first form appearing in your sidebar and that is your search you want to remove.


0

add_filter for widget_title does not allow more than one parameter when called so the above will throw PHP warnings. This seems to work instead: function my_repair_categories_empty_title() { if ( $base == 'categories' ) { if ( trim($instance['title']) == '' ) return ''; } return $title; } add_filter('widget_title', ...


0

You haven't actually said what the problem is. But I can see one for starters - dynamic_sidebar in your if conditions will echo out the widgets immediately. If you want to check a sidebar has widgets, use is_active_sidebar: is_active_sidebar( 'sidebar-1' ); // True/false


0

The classes are hardcoded in wp_generate_tag_cloud() function. Your only option there is to modify final string output via wp_generate_tag_cloud filter.


0

Here is what you are looking for: <?php class mm_location_widget extends WP_Widget { function __construct() { parent::__construct( // Base ID of your widget 'mm_location_widget', // Widget name will appear in UI __('Locations By Marvil Media Widget', 'mm_location_widget_domain'), // Widget ...


-1

If anyone is still looking for best solution, feel free to check https://wordpress.org/plugins/widget-options/ . It has a post category option to hide the widgets on associated post per category. But if you still want to do it manually; using widget_display_callback is the best one I can recommend to filter widgets.


0

If anyone is still looking for this option, I've totally recommend using this plugin instead : https://wordpress.org/plugins/widget-options/ but if you want to use custom code. You can try this one below. Thanks! add_filter( 'widget_display_callback', 'hide_widget', 50, 3 ); function hide_widget( $instance, $widget, $args ){ if ( is_page( 28 ) ) { ...


0

I looked into doing the same thing and in the end opted for a custom solution using thickbox as being less complex. Could be it's possible, but perhaps not worth the effort. The code is certainly not built for customisation as far as I could see. Open a thickbox modal with a search field Ajax search the post title with the user-entered search term Echo the ...



Top 50 recent answers are included