Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 从自定义主题选项中提取滑块数据时出错_Php_Html_Wordpress - Fatal编程技术网

Php 从自定义主题选项中提取滑块数据时出错

Php 从自定义主题选项中提取滑块数据时出错,php,html,wordpress,Php,Html,Wordpress,我试图通过使用下面的代码从我的自定义主题选项面板中获取滑块数据。这将返回以下错误 警告:第16行/home/muratgok/public_html/wp content/themes/default/page-clients.php中为foreach()提供的参数无效 我猜我的语法并不完全正确,但我正在努力寻找正确的地方。多谢各位 <?php echo $slides = $smof_data['example_slider']; //get the slides arr

我试图通过使用下面的代码从我的自定义主题选项面板中获取滑块数据。这将返回以下错误

警告:第16行/home/muratgok/public_html/wp content/themes/default/page-clients.php中为foreach()提供的参数无效

我猜我的语法并不完全正确,但我正在努力寻找正确的地方。多谢各位

        <?php echo $slides = $smof_data['example_slider']; //get the slides array

        foreach ($slides as $slide) {
            echo $slide['title'];
            echo $slide['url'];
            echo $slide['link'];
            echo $slide['description'];
        }

        ?>

尝试并确保这是一个数组$smof_data['example_slider']:

    <?php $slides = $smof_data['example_slider']; //get the slides array

    foreach ($slides as $slide) {
        echo $slide['title'];
        echo $slide['url'];
        echo $slide['link'];
        echo $slide['description'];
    }

    ?>

    <?php $slides = $smof_data['example_slider']; //get the slides array

    foreach ($slides as $slide) {
        echo $slide['title'];
        echo $slide['url'];
        echo $slide['link'];
        echo $slide['description'];
    }

    ?>