the_post_thumbnail unless video id is added

I think all you need is this: <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> if (get_field(‘channel’) == ‘Youtube’) { echo get_field(‘youtube_video_id’); } elseif (get_field(‘channel’) == ‘Vimeo’) { echo get_field(‘vimeo_video_id’); } elseif ( has_post_thumbnail()) { the_post_thumbnail(); } That should use a Youtube video, then a Vimeo video, then the thumbnail, … Read more

Add number in increment of one to DIV ID

the code should be instead add_shortcode( ‘faq’, ‘wpse105856_shortcode_callback’ ); function wpse105856_shortcode_callback( $atts ) { extract( shortcode_atts( array( ‘category’ => ” ), $atts ) ); $args = array( ‘numberposts’ => -1, ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’, ‘post_type’ => ‘faq’ ); if ( ! empty( $category ) ) { $args[‘category_name’] = $category; }; $posts = get_posts( … Read more

Custom fields randomly stop working

get_the_ID() is a post tag. It is meant to be used inside a Loop. Per a comment above you are using it outside the Loop. No, it’s not inside Loop. The code is simply posted within another div, which holds slides for a slideshow. get_the_ID like most post tags depends on a global variable called … Read more

How can I order metaboxes in my posts in WordPress?

<?php $ck = get_post_custom_keys($post_id); //Array foreach ($ck as $k) { if (substr ($k, 0, 1) == ‘_’) { // skip keys starting with ‘_’ continue; } $cv = get_post_custom_values($k, $post_id ); //Array foreach ($cv as $c) { if (empty ($c)) { // skip empty value continue; } echo ($k . ‘: ‘ . $c . … Read more