Use a shortcode to display custom meta box contents

yeah, the question is a bit unclear. but i think you need shortcode attributes function get_custom_field_fn( $atts) { global $post; extract( shortcode_atts( array( ‘meta’ => ” ), $atts ) ); $custom_field_value = get_post_meta($post->ID, $meta, true); return $custom_field_value; } add_shortcode(‘cf_name’, ‘get_custom_field_fn’); see the codex: http://codex.wordpress.org/Shortcode_API#Attributes

Infinite counting in WordPress

This looks like a custom function. It’s passing $count to a function called array_pick() to limit the size of your follower array. It also looks like array_pick() is a custom function. But you can easily stop the function from limiting your count by removing the call to array_pick(): function get_random_followers($userid, $count = 10){ $followers = … Read more

wordpress acts like functions.php doesn’t exist [closed]

When developing locally, always set the following in your wp-config.php to see all errors: // DEBUG error_reporting( E_ALL ); /** Php error log */ @ini_set( ‘log_errors’, ‘On’); @ini_set( ‘display_errors’, ‘On’); define( ‘WP_DEBUG’, true ); define( ‘SAVEQUERIES’, true ); // file: /core_root/content/debug.log define( ‘WP_DEBUG_LOG’, true ); define( ‘WP_DEBUG_DISPLAY’, true );

How to hide image-url if no attachment?

Assuming you’re following this tutorial: http://wp.tutsplus.com/tutorials/automagic-post-thumbnails-image-management/ Replace the echo statement at the end of get_attachment_picture with a return, then change your image code. Here is your new image code: // get the URL of the image $src = get_attachment_picture(); // if the url is not empty, display the image if(!empty($src)){ ?> <img src=”https://wordpress.stackexchange.com/questions/48896/<?php echo $src; … Read more

Custom Query Not Paginating

You need to set paged or an offset in your query, otherwise you’re always fetching the same 48 posts. $page = (get_query_var(‘page’)) ? get_query_var(‘page’) : 1; $args = array( ‘paged’ => $page, ‘posts_per_page’ => ’48’, ‘cat’ => ‘4’, ‘meta_query’ => array( array( ‘key’ => ‘Country’, ‘value’ => $country_search_array, ‘compare’ => ‘IN’ ) ) ); $gallery_query … Read more

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’);