Error with function in functions.php?

These two lines are wrong: add_action(‘wp_ajax_get_data’, mm_get_all_informations); add_action(‘wp_ajax_nopriv_get_data’, mm_get_all_informations); You need to quote the function name: add_action(‘wp_ajax_get_data’, ‘mm_get_all_informations’); add_action(‘wp_ajax_nopriv_get_data’, ‘mm_get_all_informations’); If you had debugging enabled, as you should when you are working, you would have spotted the problem immediately.

Echo title with permalink

This is the problem: $link = the_permalink(); Replace it with: $link = get_permalink(); Notice that the WordPress the_* functions will echo the output, but get_* will return it. But of course there are exceptions to this rule 😉 So you don’t need this: echo the_title(); Just use this instead: the_title(); or the usage example given … Read more

Register Script in Plugin Widget

There are 3 issues. Firstly, you’re calling do_action, triggering the action: do_action( ‘wp_print_footer_scripts’, ‘tab_widget_scripts’ ); When actually, you want to add your function to it, not trigger it. You should be doing this: add_action( ‘wp_print_footer_scripts’, ‘tab_widget_scripts’ ); Secondly, you’re registering this script: tabs Then enqueuing this script: tabs.js Clearly they don’t match, in the same … Read more

Can’t Write Custom Widget Code In One ECHO

Technically your first example is also incorrect, but the problem is not apparent. You’re using template tags that themselves echo their content. For example, you can write simply: the_permalink(); without echo, and the permalink will be output. This is because that function echoes its value. To output the permalink within an echo or variable assignment … Read more

Widgets won’t save

This line of code is incorrect <?php if ( !function_exists(‘redmenu_widget’) || !dynamic_sidebar(‘redmenu_widget’) ) : ?> More to the point, your negative operator (!) is wrong here That line of code simply translates to If the function redmenu_widget does not exist OR if the sidebar redmenu_widget does not exists, do something You should just drop the … Read more

‘is_author()’ logic in widget for author only

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 … Read more