小编use*_*087的帖子

in_array() 期望参数 2 为数组,Classipress 中给出的字符串

我正在使用Classipress themewordpress,并且我正在尝试将我的特色广告粘贴到类别中。

我发现一个返回此错误的代码:

Warning: in_array() expects parameter 2 to be array, string given in loop-ad_listing.php on line 26
Run Code Online (Sandbox Code Playgroud)

要使用顶部粘性代码,我必须编辑两个页面并插入两个代码,然后我将发布错误部分:

第一的:loop-ad_listing.php

代码1:

global $postisfeatured;
global $featurePostArray;

if ($postisfeatured == "1") 
    array_push($featurePostArray, $post->ID);

if (in_array($post, "ID", $featurePostArray) && $postisfeatured != "1") 
    echo '<div class="hide">';
Run Code Online (Sandbox Code Playgroud)

代码2:

if ($postisfeatured != "1") {
    appthemes_after_endwhile();
    $postisfeatured = "";
}
Run Code Online (Sandbox Code Playgroud)

那行:if (in_array($post,"ID",$featurePostArray) && $postisfeatured != "1") { 是错误。

php arrays wordpress

3
推荐指数
1
解决办法
7万
查看次数

标签 统计

arrays ×1

php ×1

wordpress ×1