<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.
Related Posts:
- ORDER BY custom field value
- Best way to programmatically remove a category/term from a post
- Using wordpress post data as input for google visualisations
- display specific custom fields
- Add new “Insert Into Post” button with another function
- Multiple meta values for same meta_key adding on “Preview Changes” hit but not on saving or updating post
- Order posts by custom field and if custom field is empty return remaining posts
- Can serialized arrays in DB be matched against serialized arrays with meta_query?
- Create a select drop down of available menus
- Best way to allow manageable social media URLS?
- Adding a prefix to a post title
- copy attachments to another post type and change attachment url
- Cannot edit post meta fields with rest API
- Only display custom field if it there is a value inside
- Slow meta query with multi meta keys
- Custom Field Multiple Clauses
- Add a post meta key and value only if it does not exist on the post
- Custom field values repeating
- Adding a custom field or metabox to the post-thumbnail widget?
- Sorting posts by multiple values, combined
- Send Multiple Custom Field Values Through the URL
- Sort by posts that have a featured image?
- WP_Query display next custom post from today’s date
- Can ordering post list by meta_value cause performance issue?
- $wp_query meta_key naming issue [closed]
- Meta_query and numeric comparison [closed]
- Title and post URL based on custom fields?
- Separate table or usermeta
- Woocommerce with metabox plugin
- using multiple meta_key and meta_value in query_posts
- Json api does not return all metadata
- Use custom field as a variable
- Multiple relationships in a query
- ACF: How to get the full field name (meta_key) by a field key?
- How Meta Data is different from Custom Fields of POST/PAGE in WordPress
- global function to apply filter to custom field
- How to add a new meta key and assign timestamp to posts
- Print custom field in Query Loop block
- Is there a simpler version of WP Media?
- Order RSS content by an advanced custom field value
- Advanced search by two criteria – sort by location and date (ascending or descending)
- modify wordpress caption shortcode
- UPDATE on SELECT results. A SQL query to swap Author with Meta Box value
- Alter main archive, to show posts with meta as last
- Add microdata from schema.org [closed]
- Displaying multiple URLs as custom field values
- Collect user custom field in product page woocommerce
- How can I save custom meta to one global value?
- get posts where a custom field contains a text
- Displaying a custom field
- meta fields for the whole wordpress site
- Importing WordPress Posts With Custom Meta Data As CSV Files Through PHPMyAdmin
- How can php be used to return data from custom fields in a post?
- Modify date query by URL parameter using pre_get_posts and $_GET
- The best way to collision check in WP
- Get meta field value of all catgories
- Displaying a custom field containing a list creates unwanted markup
- Output custom field as ul list
- Multiple Custom Field Query
- Change Page Order by Custom Field (Magic Fields)
- Custom Field is getting the value of another page/post instead of the current one?
- Custom Field Date Problem
- Approach to creating a site with this structure
- Filter post style attribute
- Update some (not all) post titles with custom field values before running the Loop
- how to turn a link field into a button or link text
- Arrays in custom fields or is there a better way?
- Use value from ACF to populate other fields
- Dynamically populate query source in Elementor post widget
- Setting user permissions per post
- Adding Facebook’s image and meta description retrieval capabilities to a WordPress post
- Weird custom fields data lost
- Why does my numeric meta query work only on one meta key and not the other?
- WooCommerce 3 get custom variation on process order [closed]
- query_posts -> get page_id from custom field
- author global display format
- Output Custom Field value to shortcode
- Update custom table on metabox POST
- display custom media folders to wordpress media popup
- Should I store arrays in custom fields or create custom tables?
- Problem saving meta data
- Term specific featured post on taxonomy archive pages
- Custom Meta Boxes and Fields for WordPress: Change directory upload based on user-edit page
- WP_query returns error when used for custom widget
- Custom field value link title
- Get custom field from other post in carousel
- Form fields based on custom fields
- show custom field content in jquery tabs
- Create citation and url in post using 3 custom fields with conditions for each field… So close!
- Post rating using Custom Field
- Inserting custom fields into new-post.php without using the Custom Fields Template plugin?
- woocommerce how in checkout to add my custom field check box, and when i check it hide the shipping adress and add tax 19% [closed]
- How can I attach files without using a plugin?
- Advanced Custom Fields for Header that are Editable from a Page [closed]
- Show only first image of multiple image field
- Change Fields of Comments and make them searchable?
- Shortcode not picking up custom field
- Custom Fields after update to WordPress 6
- Dynamically update Custom Fields to display new dates
- save all acf options in one meta_value [closed]