LeoAltair
Forum Replies Created
-
Forum: Hacks
In reply to: remove_action not removing action (on wp_widgets_init)The removal works great with this hook !
To be sure I list all the widgets only after the
widgets_init
hook :add_action( 'after_setup_theme', 'hook_the_remove', 1) ; function hook_the_remove() { remove_action('init', 'wp_widgets_init', 1); add_action('widgets_init', 'show_widgets_list', 999999) ; other_widgets_init() ; } function other_widgets_init() { if ( !is_blog_installed() ) return; do_action('widgets_init'); } function show_widgets_list() { global $wp_widget_factory; foreach($wp_widget_factory->widgets as $name => $w) echo $name . ' - '; }
I also replaced all my calls to
the_widget
with this to avoid errors messages in case a widget cannot be found :function secure_widget($name, $ins, $args) { global $wp_widget_factory; if (array_key_exists($name, $wp_widget_factory->widgets )) the_widget($name, $ins, $args); //else echo "<b>$name</b> is not present"; } function test_widget($name) { global $wp_widget_factory; if (array_key_exists($name, $wp_widget_factory->widgets )) return true ; return false; }
Thanks for your help !
Forum: Hacks
In reply to: remove_action not removing action (on wp_widgets_init)Yes it’s in a plugin file. I don’t see what you mean. The action I’m trying to remove has the priority “1”, which seems pretty early a priority. And it is part of the wordpress core. I don’t see how I can be before.
You mean I should put my
remove_action('init', 'wp_widgets_init', 1);
in another ‘init’ ? Like in this ?
add_action( 'init', 'hook_the_remove', 1) ; function hook_the_remove() { remove_action('init', 'wp_widgets_init', 1); add_action('widgets_init', 'show_widgets_list', 999999) ; other_widgets_init() ; }
That sounds wierd. And I tested it, it doesn’t work : the default widgets are still loaded, even if after the others.
I am able to remove it with your code from an ‘init’ action hook callback.
Could you show me your code please ?
Forum: Fixing WordPress
In reply to: Custom post type, taxonomy and permalinks helphave a look at this, I think this is close to what you’re trying to do :
https://justintadlock.com/archives/2009/06/04/using-custom-taxonomies-to-create-a-movie-database
https://justintadlock.com/archives/2010/08/20/linking-terms-to-a-specific-post
Forum: Fixing WordPress
In reply to: custom post descriptionsEach tool (Preparation, Assessment, etc.) is a custom post. On the WP Admin, each tool is a category;
Not clear for me : is it a custom post or a category ?
If it’s a post, you could use editor for the big text (the_content) and excerpt for the description-preview (the_excerpt : check spelling, I never get it right)
As the big text is just desc + a list, you could even simplier put a “more” separator in you editor and have an automatic exerpt
Forum: Fixing WordPress
In reply to: Export / Import Custom TaxonomiesThe patch works fine fot export BUT the import fails :
post created ok
taxonomy terms created ok
post-terms link NOT OK, I have to manually reassign them, THAT sucks !