post_id is being ignored
-
I have a function in functions.php which embeds a video url from a text-only custom field in the WP admin area (which contains a YouTube video URL).
I want the same video to show on all pages so have added the post_id after the custom field name. The video shows fine on the home page (post_id=2) but not on other pages.
Could someone point out where I’m going wrong? Many thanks in advance…
function show_vid() { if (get_field("video_url")): $vid_url = get_field("video_url",2); global $wp_embed; $post_embed = $wp_embed->run_shortcode('[embed]'.$vid_url.'[/embed]'); echo '<div class="vid-area">'.$post_embed.'</div>'; endif; }
https://www.ads-software.com/plugins/advanced-custom-fields/
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘post_id is being ignored’ is closed to new replies.