How to access advance custom fields with post type in a for each loop

<?php $slider = get_posts( $slider = g array( ‘post_type’ => ‘event’, ‘posts_per_page’ => – 1 )); ?> <?php $count = 0; ?> <?php foreach($slider as $slide): ?> <?php setup_postdata( $slide); $title = the_field(‘event_name’); ?> <?php endforeach; ?> <?php wp_reset_postdata(); ?> Or <?php $slider = get_posts( $slider = g array( ‘post_type’ => ‘event’, ‘posts_per_page’ => – … Read more

Show specific posts with WP_Query using ACF Post object

now we are getting there.. you really need to try to explain, what your problem is, its not very clear in your question. my assumption is, you tried this one, but it didn’t work out: foreach( $post_objects as $post_object): get_template_part( ‘includes/content’, get_post_format( $post_object->ID ) ); endforeach; and here is why: you call the template, but … Read more

How can I copy an ACF field to AIOSEO field? [closed]

2 things I noticed: get_field() isn’t specifying a post to get the field from, which is necessary outside the loop: $add_description = get_field( ‘body’, $post->ID );` And to set a post meta value you should use update_post_meta(), not wp_update_post(): update_post_meta( $post->ID, ‘_aioseop_description’, $add_description );

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)