我在使用自定义字段正确输出滑块中的图像目录时遇到了问题。我正在使用的代码如下:
<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/。有任何想法吗?谢谢您的帮助!