Get image url using image id

You can use REST API to retrieve media item. Just send GET request to this address (change example.com to your site): http://example.com/wp-json/wp/v2/media/<id> If you pass correct ID, then you’ll get all info regarding that media file. For example I get something like this for one of my image files: { “id”: 546, “date”: “2019-01-23T11:22:15”, “date_gmt”: … Read more

Where does this field get its value?

That clearly is a plugin field of “Advanced Custom Fields”. The function: the_field(); is one of the utility functions of the plugin. The purpose of “Advanced Custom Fields” is to enable users with less coding-knowledge to add custom fields to a theme/template. So, in order to reverse engineer the whole thing, you propably need to … Read more

Shortcode To Display Post Custom Field Value in Post Title, Post Content

the_title filter takes two parameters, one of them is the ID of the post for which it was called. Something like that should work. add_filter( ‘the_title’, ‘se385007_title_filter’, 20, 2 ); function se385007_title_filter( $title, $post_id ) { $new_title = str_replace( “[geo_name]”, “[geo_name post_id=$post_id]”, $title ); return do_shortcode( $new_title ); )

Syntax Issue: How Do I Call A Custom Field Inside a ForEach Statement? [closed]

<ul> <?php $recent_posts = wp_get_recent_posts(array(‘post_type’=>’news’)); foreach( $recent_posts as $recent ) { echo ‘<li><a href=”‘ . get_permalink($recent[“ID”]) . ‘” title=”Look ‘.esc_attr($recent[“post_title”]).'” >’ . $recent[“post_title”].'</a> </li> ‘; echo ‘<p>’ . get_field(“news_source”,$recent[“ID”]) . ‘</p>’; } ?> </ul> It looks your are passing get field parameters incorrectly. I assumed “news_source” is your custom field name in acf.

Hide custom column in admin template screen (Elementor) [closed]

Use the second parameter $post_type passed to manage_posts_columns and ignore adding the column if it matches elementor_library: add_filter( ‘manage_posts_columns’, ‘customfield_add_column’, 5, 2 /* <= Make sure you add the 2 here to pass the second parameter to your callback */ ); function customfield_add_column( $defaults, $post_type = null ) { if ( $post_type !== ‘elementor_library’ ) … Read more

Displaying page image in the footer automatically

You want to use the Featured Post Thumbnail: http://wpcanyon.com/tutorials/how-to-use-the-post-thumbnail-feature-in-wordpress-2-9/ http://markjaquith.wordpress.com/2009/12/23/new-in-wordpress-2-9-post-thumbnail-images/ http://codex.wordpress.org/Function_Reference/the_post_thumbnail In your functions.php, define an image size with add_image_size(), then display it in the footer like this: the_post_thumbnail(‘footer-image’); Keep all of the loop inside of your main template file and do not split it across multiple files. That’s really messy, and as you’ve figured … Read more