Using ACF Custom Field value in a URL with do_shortcode() [closed]

Simply you need to replace the_field(‘video’) with get_field(‘video’). Why? Because according to ACF documentation; get_field($field_name, $post_id, $format_value) Returns the value of the specified field. Whereas on the other hand the_field($field_name, $post_id) Displays the value of the specified field. (this is the same as “echo get_field($field_name)”) Hope this might help others as well.

Update the value of every page’s content editor with the value of an Advanced Custom Field on that page

Solution: Add this to functions.php and refresh admin once. Remove after. function process_post() { $my_posts = get_posts( array(‘post_type’ => ‘page’, ‘posts_per_page’ => -1 ) ); foreach ( $my_posts as $my_post ) : $value = get_field(‘course_content’, $my_post->ID ); if($value): $update_post = array( ‘ID’ => $my_post->ID, ‘post_content’ => $value ); wp_update_post( $update_post ); endif; endforeach; } add_action( … Read more

Different body image backgrounds on different pages, posts and categories

You need to add the classes for the corresponding cases. For pages/posts: $css = “body.page-id-**post_id** { background-image: url(‘$bg_image’); }”; For categories: $css = “body.category-**category_id** { background-image: url(‘$bg_image’); }”; You can retrieve post_id with $post->ID. For the category you need to check whether the page is_archive() and to append the corresponding ID or category name.

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