Tag Info

New answers tagged

0

So here is what's happen : When you create a widget and init it in functions.php he will be placed, with all it's content(that means the html from public function form( $instance )), into <div id="widget-list"> (the area from the left of the admin panel which list all the widgets). So when you will drag it onto the widget area you will have 2 of them ...


0

My other answer was deleted :( don't really get why, tried to edit, but it remained deleted. so here's again. hopefully it stays, as the problem still exists. it doesn't work, well not like I wanted to... because the message shows up on every page, even on the starting part of the blog http://wrestling-talk.de/wordpress I used get_the_date('U') <= ...


0

I assume you would like to do this through the WordPress admin and not edit your sidebar.php so here is a possible solution. First, find out what the timestamp of August 22 was at http://www.epochconverter.com. Based on GMT time I got "1408665600" Install the Widget Logic Plugin: https://wordpress.org/plugins/widget-logic/ Add a widget to your left ...


0

Extending Jan's answer, I found strpos() rather than strncmp() for checking the widget name (it's faster.. ) Following you'll find a similar function (working & tested) that will take you to the same result: add_filter( 'sidebars_widgets', 'hide_widgets' ); function hide_widgets( $excluded_widgets ) { if ( is_page() /* Or whatever */ ) { ...


0

I found the solution. I Changed enctype="text/plain" to enctype="application/x-www-form-urlencoded" and that worked.


0

I have deleted the lines of code I mentioned above and only left the remaining code in sidebar.php. The problem was they were hard coded so they appear if visibility is set to hidden to the sidebar widgets.


0

function wpsites_remove_default_widgets() { unregister_widget('WP_Widget_Pages'); unregister_widget('WP_Widget_Calendar'); unregister_widget('WP_Widget_Archives'); unregister_widget('WP_Widget_Links'); unregister_widget('WP_Widget_Meta'); unregister_widget('WP_Widget_Search'); unregister_widget('WP_Widget_Text'); ...


1

Ok, finally the support team answered my question, and if even if there's not a real solution, suggested a workaround. Since the answer is buried deep in the vendor user forum - link here - I'm sharing the solution here, just in case someone has the same problem with this or another theme. Basically it's a bug in the parent theme (Toolset Bootstrap), that ...


0

First of all, thanks to @toscho for the detailed answer. This is a simple example for those who are searching for a simple solution and default widget options: $active_sidebars = get_option( 'sidebars_widgets' ); //get all sidebars and widgets $widget_options = get_option( 'widget_name-1' ); $widget_options[1] = array( 'option1' => 'value', 'option2' ...


1

This seems to test properly for me. function register_home_sidebar() { /* Register the new sidebar. */ register_sidebar( array( 'id' => 'home-sidebar', 'name' => __('Home Sidebar'), 'description' => __( 'This sidebar will display only on the homepage.'), 'before_widget' => '<aside id="%1$s" class="widget ...


1

One common way to do similar task is creating a page template. For example: <?php /* Template Name: Reviews and Quotes */ get_header(); ?> <div id="content"> <div id="reviews"> <?php $reviews = get_the_reviews(); foreach( $reviews as $review ) { <?php <div ...


2

There isn't a standard way to do it AFAIK in the form() method; here's a function to do it: function wp158055_get_sidebar_id( $widget ) { foreach ( wp_get_sidebars_widgets() as $sidebar_id => $widget_ids ) { if ( array_search( $widget->id, $widget_ids ) !== false ) return $sidebar_id; } return false; } And call with $this. Note ...


0

You can use The Codex to learn about Adding A Dashboard Widget at which point in the dashboard widget callback you can add your form or whatever you need. Toward the top of your callback function you could add a test to check if a form posted if(isset($_POST)) Then you can save your values, maybe using update_option() which will save your information to ...


1

I think I see the problem now. None of your links have a closing anchor tag which is cascading down until it hits the end at which point you close it on phone number: Your Code: echo '<a href="'.$facebook.'" target="_blank"><img src="'. get_stylesheet_directory_uri() .'/images/fb.png" height="24" width="24" alt="facebook">'; What it should ...


0

I think something exists in Wordpress 3.9 that might help you. It's the widget-updated callback. Use it like this (coffeescript): $(document).on 'widget-updated', (event, widget) -> doWhatINeed() if widget[0].id.match(/my_widget_name/)


0

Remove: 'no_found_rows' => true, from your WP_Query call inside the widget code. Additionally I would suggest to make this change : 'base' => add_query_arg( 'latest_page', '%#%' ), in your paginate_links call, because add_query_arg() will handle if ? or & is used. This should make the pagination work in your widget. Note: I'm almost, ...


1

You can use any of the parameters from wp_list_categories and the widget_categories_args filter You can style the output with these CSS selectors: li.categories { ... } li.cat-item { ... } li.cat-item-7 { ... } li.current-cat { ... } li.current-cat-parent { ... } ul.children { ... }


0

First you will replace this line <div id="%1$s" class="widget %2$s" data-custom-title=""> with <div id="%1$s" class="widget %2$s" data-custom-title="DCT"> Now add the filter in your functions.php file. add_filter( 'widget_display_callback', 'add_custom_data_to_before_widget', 10, 3 ); function add_custom_data_to_before_widget( $instance, ...


-1

You want to use a not (!) in your conditional. if (!is_active_sidebar('NameOfSidebar')){ // Must not display the section title. } else { // Display the sidebar here. } The first condition will return true if is_active_sidebar() returns false. is_active_sidebar() returns false if that sidebar has no active widgets saved to it.


0

Try is_active_sidebar if ( is_active_sidebar('your-sidebar-i.d')) Where your-sidebar-i.d equals the I.D you use when you register the sidebar.


1

There is, in fact! The global variable $wp_registered_sidebars stores the registered sidebars, and $wp_registered_widgets stores all registered widgets (by widget ID).


0

if your theme have not search-form.php file then you will create the file and add the custom css there. Because search widget is calling the get_search_form() function. First it will search the search-from.php file from activated theme folder. If there have no file then it will call wp's default search form. See the Codex


0

It does seem that you are already using a custom function that you found from this site. You should credit the original author of that code. The widget_comments_args filter was introduced in Wordpress3.4. This filter is poorly documented. This filter uses get_comments(), so you can also use the same parameters. Here is the filter in ...


0

Use the widget_posts_args to modify the args in the get_comments functions for that default widget. Something like this: function wpsites_widget_comments_args( $args ) { $args = array( 'post_type' => array( 'attachment', 'post', 'page'), 'number' => $number, 'status' => 'approve', 'post_status' => 'publish' ); return $args; } ...


0

In your style.css add this: .widget { margin-bottom: 20px; } That should give all your widgets 20 pixels of spacing but only works when the widgets are stacked on top of eachother. If you have multiple sidebars and only want this to happen on a single sidebar, add a more-specific selector i.e. .my-special-sidebar .widget { margin-bottom: 20px; } But ...


0

Your widget is an extension of the WP_Widget class, which defines the widget function. This is where your code should go. class WPDev_156470_Widget extends WP_Widget { // other stuff public function widget( $args, $instance ) { if ( ! is_user_logged_in() ) { echo ''; return; } // logged-in-user ...



Top 50 recent answers are included