Error call_user_func_array() expects parameter 1 to be a valid callback when using image_size_names_choose

You can’t define a hook callback function inside another function. You’ve defined my_custom_sizes() inside setup(), which means that my_custom_sizes() cannot be called outside of the scope of setup(). This is a problem because the hook, image_size_names_choose, is not run inside your setup() function. You need to define your callback in the global scope: function setup() … Read more

What is @Action in WordPress?

This is called php annotations. Many of them are built-in via a standard called phpdoc (like @var), and they are used by the interpreter or the static tools (also by humans for a more structured comment). There is another usecase for these annotations, and it’s to run some code – probably using reflections (which usually … Read more

Redirect to another page using contact form 7? [closed]

Redirect to another page using contact form 7? [closed]

Global custom meta box

In addition to the other answers, you can further improve it by looping through an array of types instead of manually adding a new add_meta_box() line each time you add a new type. $postTypes = array( ‘custom-post-type1’, ‘custom-post-type2’, ‘custom-post-type3’ ); foreach( $postTypes as $pt ) add_meta_box( ‘adv_form_box1’, ‘Advanced Form’, ‘adv_form1’, $pt, ‘side’, ‘high’ );

How can I show my latest tweet in my wordpress blog?

function get_twitter_feed(){ $userID = ‘ImOttoman’; //your twiter username $url=”http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=$userID&count=1″; $xml = simplexml_load_file($url) or die(“could not connect”); foreach($xml->status as $status){ $text = $status->text; } echo $text; } add_filter(‘wp_head’,’get_twitter_feed’); You never said where you want it so this just pops it into the head (not a great idea), and is a bad example lol. Instead you should … Read more

Add a jQuery Function

First, don’t unregister and reregister jQuery. There’s no reason to do that at all. Second, you’re enqueuing on the wrong hook. Instead, use this in your functions file: // Enqueue Scripts function wpse78227_enqueue_scripts() { wp_enqueue_script( ‘jquery’ ); } add_action( ‘wp_enqueue_scripts’, ‘wpse78227_enqueue_scripts’ ); Now, to include that script you need to do a couple of things. … Read more