Tag Info

New answers tagged

0

class MyPluginClass { public function __construct() { add_action( 'save_post', array( $this, 'myplugin_save_posts' ) ); } public function myplugin_save_posts() { // do stuff here... } } $mypluginclass = new MyPluginClass(); check in Using Add Action In Your Class in WordPress Codex


1

Can you try adding the following code to the functions.php file in your theme directory and see if works for you function keep_raw_filename( $filename, $filename_raw ) { return $filename_raw; } add_filter( 'sanitize_file_name', 'keep_raw_filename', 10, 2 );


0

You're seeing $action empty because there is a redirect from wp-admin/edit.php. So, the output you are seeing is after the redirect. Use, die() after echo $action to see the output before the redirect.


0

One of the parameters of the enqueue_script function is the $in_footer take a look of the function usage arguments: wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ) So to add your script(or css) to the header instead of footer you should try something like: wp_enqueue_script('tooltipster', urlto.'/jsjquery.tooltipster.min.js', array( ...


2

It seems that you need to add styles and scripts to a single post. The best way to achieve this is to make use of the conditional tag is_single() With that you target specific single posts or all single posts. Styles should always be loaded in the header. <link> tags outside the <head></head> tags are invalid HTML. You should check this ...


0

I cant figure out where to hook so that A. The $post is set up and 2. the style and script get included in the header. Those two things are mutually exclusive. The global $post won't be set up until the main Loop starts, which is well after the header has already been output. Edit for comments clarification: Again, the actual global $post isn't set ...


0

It must be pretty late in the action order because I've tried hooking to admin_notices from it and it doesn't work. $function callback (param of add_submenu_page) is used to output the content of admin pages, so it runs when WordPress is actually displaying the markup (body) of page. That should be pretty clear because you use echo inside that ...


1

You can simply use current_filter() WordPress function. http://codex.wordpress.org/Function_Reference/current_filter



Top 50 recent answers are included