How to use array in function to get only value I want

There’s wp_list_pluck() to get certain fields out of arrays or objects: $object = new StdClass(); $object->foo = ‘Hi!’; $object->bar=”Yo!”; $array[‘foo’] = ‘Hi!’; $array[‘bar’] = ‘Yo!’; $result_obj = wp_list_pluck( $object, ‘foo’ ); var_dump( $result_obj ); // Result: string (3) Hi! $result_array = wp_list_pluck( $array, ‘bar’ ); var_dump( $result_array ); // Result: string (3) Yo!

WordPress Migration error phpupdate_option is not a function

It sounds like your opening <?php tag is abutting your first call to update_option. If it isn’t directly adjacent to it, perhaps the whitespace between the two is unrecognized for one reason or another (this can happen from copying and pasting from some sources). Have your functions.php file start off like this: <?php update_option(‘siteurl’,’http://example.com/blog’); update_option(‘home’,’http://example.com/blog’);

Adding code using functions.php in child theme

You get the $content as a parameter for your function, and you should not echo anything in that function. Return a string instead. Example: add_filter( ‘the_content’, ‘app_bits’); function app_bits( $content ) { if ( ! is_singular() ) { return $content; } $extra=”<div style=”text-align: center;”>custom code goes here</div>”; return $content . $extra; } See How to … Read more

Auto-Tweet if Type is ‘Status’ using OAuth

My guess is that you aren’t hitting the {$old_status}_to_{$new_status} action, which is what you are hooking to with draft_to_published – for new posts there is no guarantee that the “old” status is actually “draft”. Have you tried using the {$new_status}_{$post->post_type} action, which in your case would be publish_status?

is there a way to remove featured image from blog page and single page

If you don’t want to modify the template files directly, you could always make use of the post_thumbnail_html filter: function wpse70960_filter_post_thumbnail_html( $html ) { if ( ( is_home() || is_single() ) { return ”; } else { return $html; } } add_filter( ‘post_thumbnail_html’, ‘wpse70960_filter_get_post_thumbnail_html’ ); This code snippet goes either in your functions.php file or … Read more

Basics of changing plugin output

Take a look at WordPress hooks from the Plugin API. There are actions and filters to be used by plugin authors so that other developers could alter the content without changing the core code. However, if they are not used properly (or missing), the only two options are CSS changes (wherever possible, because stylesheets could … Read more