2016-05-15 7 views
-1

私はタイトルに広告タイトルに問題があります:PタイトルにWordpress ad_filter

私はちょうどカスタムポストタイプを作成しました。私はこれを使用する場合、私は503エラーを取得した後

function pobierajslowa() { 
     $args=array(
       'orderby' => rand, 
       'post_type' => 'slowa_kluczowe_wpisu', 
       'posts_per_page' => 1, 
       'caller_get_posts'=> 1 
      ); 
      $queryObject = new WP_Query($args); 
      while ($queryObject->have_posts()) { 
       $queryObject->the_post(); 
       return get_the_title(); 
      } 
} 


function theme_slug_filter_the_content($title) { 
    $custom_content = $title; 
    $custom_content .= ' '.pobierajslowa().''; 
    return $custom_content; 
} 

add_filter('the_title', 'theme_slug_filter_the_content'); 

::私が間違って行う持っているものO今私はここに私のコードでカスタムポストタイプから要素からランダムにタイトルを取得し、POST(標準ポスト)した後、それを書きたいです?

+0

これは無関係ですが、 'slowa_kluczowe_wpisu'投稿がない場合には' else'を追加することをお勧めします... – rnevius

答えて

1
'orderby' => rand, 

'orderby' => 'rand', // a string 

構文をダブルチェックすることを確認してください...であるべき。 WP_Debugをオンにすると、問題がどこにあるかがわかります。

関連する問題