Ce poate cauza afișarea unei imagini reprezentative să eșueze?
Scriu un child theme pentru tema editr și imaginea reprezentativă nu apare pentru un post nou. Imaginile reprezentative sunt afișate corect pentru conținutul demo. Pentru noul post, se generează următorul markup:
<div class="featured" data-img_bg="">
<img src="" alt="" style="display: block;">
</div>
Secțiunea relevantă din template este:
<?php if ( ( $show_thumb || $show_thumb == '' ) && has_post_thumbnail() ) { ?>
<div class="featured" data-img_bg="<?php echo $image; ?>">
<img src="<?php echo $image; ?>" alt="">
</div>
<?php } ?>
Mediul este o mașină virtuală Vagrant locală cu Ubuntu 14.04, nginx, php 5.6.
Am bifat 'Display featured thumbnail?' și 'Featured post?' în editorul de post. În partea de sus a template-ului, am observat că valoarea lui $image este goală:
<?php
$show_thumb = get_post_meta(get_the_ID(), 'aq_show_thumbnail', TRUE);
$thumb = wp_get_attachment_url( get_post_thumbnail_id(), 'full');
echo 'thumb value is set to'.$thumb;
$image = aq_resize( $thumb, 1000, 400, true );
echo 'image value is set to'.$image;
?>
ACTUALIZARE
Analizând cu xdebug, funcția aq_resize eșuează la următorul cod:
else {
$editor = wp_get_image_editor($img_path);
if ( is_wp_error( $editor ) || is_wp_error( $editor->resize( $width, $height, $crop ) ) )
return false;
$resized_file = $editor->save();
if(!is_wp_error($resized_file)) {
$resized_rel_path = str_replace( $upload_dir, '', $resized_file['path']);
$img_url = $upload_url . $resized_rel_path;
} else {
return false;
}
}
$editor
este setat la 'No editor could be selected.' (Nu a putut fi selectat niciun editor)

Extensia PHP GD nu era instalată pe mașina mea de dezvoltare. Instalarea php5-gd a rezolvat problema - sudo apt-get install php5-gd
Parcurgând codul cu ajutorul xdebug am descoperit că funcția aq_resize
din temă eșua la următorul cod:
else {
$editor = wp_get_image_editor($img_path);
if ( is_wp_error( $editor ) || is_wp_error( $editor->resize( $width, $height, $crop ) ) )
return false;
$resized_file = $editor->save();
if(!is_wp_error($resized_file)) {
$resized_rel_path = str_replace( $upload_dir, '', $resized_file['path']);
$img_url = $upload_url . $resized_rel_path;
} else {
return false;
}
}
$editor
era setat pe 'No editor could be selected.' (Nu s-a putut selecta niciun editor)

Este HTML afișat pe pagină? Dacă nu, atunci problema este aproape sigură în instrucțiunea ta condițională if. Ar trebui să fie:
if ( ( $show_thumb || $show_thumb !== '' ) && has_post_thumbnail() )
în loc de:
if ( ( $show_thumb || $show_thumb == '' ) && has_post_thumbnail() )
