2016-08-30 5 views
-2

WordpressでWidget Logicプラグインを使用している特定のページにのみウィジェットを表示しようとしていますが、両方の(Line2とLine3)私がコードの各部分を試してみると素晴らしいことです。WordpressでWidget Logicプラグインを使用して特定のページにウィジェットを表示

$cats = array('test1','test2','test3'); 
global $post; return (in_array(1317, get_post_ancestors($post))) || is_tax('categories', $cats); 
global $post; return is_single() && has_term($cats, 'categories', $post->ID); 

答えて

0

OK私は...場合は、両方の状況で、今正常に動作

$cats = array('test1','test2','test3'); 
global $post; 
if ((in_array(1317, get_post_ancestors($post)))) || is_tax('categories', $cats)) { 
return true; 
} 
elseif (is_single() && has_term($cats, 'categories', $post->ID)) { 
return true; 
} 
else return false; 
を追加しました
関連する問題