カスタム フィールドを使用して、スライダー内の画像のディレクトリを適切に出力するのに問題がありました。私が使用しているコードは次のとおりです。
<div class="container">
<?php
//path or directory where the images are stored
$directory = "echo get_post_meta($post->ID, 'directory', true)";
//read all files with a .jpg extension
$images = glob($directory . "*.jpg");
//output the required HTML code to display the images in the gallery
foreach($images as $image)
{
echo '<div class="content"><div><a href="'.$image.'"><img src="'.$image.'" width="120" height="80" alt="this is a test" class="thumb" /></a></div></div>'."\n";
}
?>
</div>
動的に出力したい値は $directory = "" で、通常は $directory = "images/product1/" のようになります。カスタム フィールドの「ディレクトリ」を images/product1/ として設定しています。何か案は?助けてくれてありがとう!