0
WPのUIでカスタムフィールドを使用して入力されたテキストと同じテキストにcategory_name
を入力します。したがって、$category_name
以下の変数を置き換えるとcat_energy
と入力します。ユーザー入力に基づく配列のカテゴリ名変数
//Category loop
$args = array(
'category_name' => $category_name,
'post_type' => array('page', 'post'),
'order' => 'ASC',
'posts_per_page' => '6',
);
$loop = new WP_Query($args);
私は「this_category」は、この場合には、カスタムフィールドの名前を使用することを述べ正しいように見えたことがわかりました唯一の答え:
$category_name = get_post_meta($post->ID, 'this_category', true);
しかし、これは私のために働いていません。誰でも私を助けてくれますか?私は本当にそれを感謝します。