Function shortcode – Set Parameter

There is a basic shortcode example in the Codex. function bartag_func( $atts ) { extract( shortcode_atts( array( ‘foo’ => ‘no foo’, ‘baz’ => ‘default baz’ ), $atts ) ); return “foo = {$foo}”; } add_shortcode( ‘bartag’, ‘bartag_func’ ); The array is the shortcode defaults and is used to fill in for any attribute that isn’t … Read more

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.

Proper way to use plugin functions in functions.php

The active theme’s functions.php is included on the backend because a theme can be configurable from the backend. If your theme depends on the functions of a plug-in being available, then you must either make sure the plug-in is always available or make your theme robust enough to handle situations where it isn’t. You could … Read more