Tag Info

New answers tagged

0

We need to wp_enqueue_script the script and wp_enqueue_style the style with add_action to the functions.php file. Just include a jQuery file and stylesheet file by this script. // Register Scripts & Styles in Admin panel function custom_color_picker_scripts() { wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_script( 'iris', admin_url( ...


0

You forgot the constructor Example: function __construct() { parent::__construct( 'foo_widget', // Base ID __( 'Widget Title', 'text_domain' ), // Name array( 'description' => __( 'A Foo Widget', 'text_domain' ), ) // Args ); } http://codex.wordpress.org/Widgets_API


0

WordPress has a function for that already. is_active_widget As the codex points out you must use the function after the widgets have all loaded. Then test the conditions with an if statement and if the map widget is not loaded you can run the rest of your script to load the map in your template. http://codex.wordpress.org/Function_Reference/is_active_widget ...


0

Your form needs to have method="post" and action="someScript.php" defined. It will send the post variables to wherever you deifine in your action="" <form method="post" action="someScript.php" > <p> <label for="db_sub_name">Name</label> <input type="text" name="db_sub_name" id="db_sub_name" value="" ...


0

Can't you use a plugin for that? There is a nice mailchimp plugin available with a widget and submission form, Mailchimp For WP. It populates your mailchimp account and that is an awesome tool for marketing emails...


1

Go to Settings -> SiteOrigin Page Builder. Enable "Bundled Widgets" and save settings. Embedded Videos (PB) should be available now.


0

You can use: $obj = get_queried_object(); $user_id = get_current_user_id(); // check if page's post author is same as logged in user if (isset($obj->post_author) && $obj->post_author == $user_id) { // ... do your stuff here } With get_queried_object function you get object of the current page. As it's requested that page should be of ...


2

is_author() is only for Archive pages. Quote from the Codex: is_author() checks if an Author archive page is being displayed So viewing a single Post or Page isn't going to get a TRUE from is_author(). I think you'll want something more like this: global $post,$current_user; // get the global variables to check get_currentuserinfo(); // get ...


1

You are stomping on the global wordpress posts with your plugin. Doing your wp_query call and then calling $recent_articles_wtb->the_post(); means that later (after your loop), you will want to call wp_reset_postdata(); # Thanks Milo That should reset the global $current_post and $post objects.


-1

Accidently deleted very essential widgets (wifi and battery) so created a new user and then copied its configuration to the older one, and IT WORKED!


0

I'm not sure I fully understand what you're trying to achieve, but I'd suggested to attempt to construct the field's ID and name from data you've got available from the source code of the generated widget. If you check out the code, you'll find that by every widget, there's a hidden form field called id_base and widget-id - this should be enough to figure ...


1

Just to weigh in from a different angle - rather than auto-upgrade all settings on plugin update, simply check for an "old" setting & map to "new" settings on-the-fly: function widget( $args, $instance ) { if ( isset( $instance['old_setting'] ) ) $instance = self::_version_compat( $instance ); } static function _version_compat( $instance ) ...


0

I would suggest looking at using transients for your data. Using transients would also take care of needing to use cron to update the data. Transients are an under utilised function of Wordpress and can save considerable loads on resources as sites get busier. Vee


2

I've did a quick test on just changing the option and it seems to work. What I did is: Wrote a widget that has just 2 fields: "Title" and "Name". Add several instances of this widget to my sidebars. Been sure that they are shown correctly in frontend. Edited the class to use 3 fields: "Title" and "First Name" (to replace "Name") and added "Last Name". ...


0

Off the top of my head, each instance of a widget is given some sort of unique ID. I want to say that becomes a prexfix to the keys for the widget. I remember poking at this some time ago but can't remember what the exacts were, sorry.


0

@PieterGoosen is correct, in dynamic_sidebar ( 'Widget Area 1' )) you are calling the name, not the ID, which is widget-1. Try using the ID instead.


1

The Title of this post is for unregistering widgets not really sidebars, though I am glad the user got what they were looking for. For those searching for how to unregister widgets using a child-theme where the widget was registered in the parent theme, you can do that with this: Assuming the Parent Theme's Widget is registered at the widgets_init hook, all ...


0

Based on your comment that the mashable.com menu is what you are going for, I'll be assuming that you want to structure your HTML similar to that (which is to say ul.menu > li > a + ul.submenu + ul.featured-content). That said, that's really implementation details which you can refine for your use case. Before I get into the code, I should note that ...


0

@Bergmann,It is possible to display 5 ads in single page using single widget "if all ads are together" . But if you want all ads at different places , you have to create different widget areas and different widgets .


2

Add a widget area to your single.php, front-page.php, home.php or whatever you want.. template's theme file. Than at the back-end go to Appearance > Widgets and move the widget to the widget area you just created.


0

I re-wrote the function, taking a few liberties with it. The main change was specify the ID of the association to link to in your call to get_permalink and to just use $association->ID instead of calling get_the_title (though you could just place the same ID in get the title). I also switched from using the_post() to using next_post() which pulls the ...


1

I believe that if you are not going to do a massive sql insert (which I think is likely just as efficient) that you need to go ahead and utilize the plugin api and at the time of the button being pressed, create them. I think it's pretty clear your choice is either to create the widgets on the fly, or to import through an sql insert. ...


0

Obviously, the below would require being familiar with php, but I'd personally recommend doing the following: Find all filters in your theme making use of the php_text filter (use a good editor that can locate all instances within a directory). Once you have found them, delete them. Note that you won't be able to update the theme without having to do ...


0

function my_theme_sidebars_widgets( $sidebars_widgets ) { if(is_page(28)) $sidebars_widgets['sidebar-10'][2] = null; return $sidebars_widgets; } add_filter( 'sidebars_widgets', 'my_theme_sidebars_widgets' ); ok, I have found a filter for it. I hope this 'null' is fine.


0

I know this is a dead horse and that Chip has pretty much covered it, but wanted to add a few thoughts. If you make a living programming and find yourself working on wordpress sites under deadlines, you are going to find that it really comes down to time. More often than not, especially for those just starting out, it is much faster and simpler to just add ...



Top 50 recent answers are included