1
我嘗試了本網站或其他網站上給出的所有解決方案,但未根據自定義字段付款程序包找到排序帖子的成功。我想下面的代碼Wordpress如何根據自定義字段對帖子進行排序
$args = array('meta_key'=>'et_payment_package','meta_key'=>693);
// Variable to call WP_Query.
$the_query = new WP_Query($args);
if ($the_query->have_posts()) :
// Start the Loop
while ($the_query->have_posts()) : $the_query->the_post();
the_title();
the_excerpt();
// End the Loop
endwhile;
else:
// If no posts match this query, output this text.
_e('Sorry, no posts matched your criteria.', 'textdomain');
endif;
wp_reset_postdata();
它顯示
對不起,沒有職位符合您的條件。
我很抱歉錯誤meta_key鍵入代替meta_value.Thank你的答案。 – ashyam
感謝您的迴應,但它不起作用它不顯示錯誤信息,但沒有變化的職位順序。實際上,我想根據包自由選擇,特色等顯示帖子。 – ashyam
你可以添加更多信息在您的帖子 - 這是什麼自定義帖子類型,是插件還是主題? Woocommerce還是? –