我有下面的代碼缺少一部分以確定要使用哪個'post
'。向wordpress循環添加新參數
HTML
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php
$postAlign = get_post_meta(get_the_ID(), 'postType', true);
if ($postAlign == 'Lsection') {
get_template_part('article' , 'Lsection');
}
else {
get_template_part('article' , 'Rsection');
}
else {
get_template_part('article' , 'Fsection');
}
?>
<?php endwhile; ?>
<?php endif; ?>
我要的是 後話了具有 'Lsection' 使用article-Lsection.php
, 後話了具有 'Rsection' 使用article-Rsection.php
, 。如果postAlign的postAlign該帖子有postAlign'Fsection'使用article-Fsection.php
我知道我必須有一個其他的如果或某些類似功能invdved
全部三項工作謝謝 – user3550879
不錯 - 請看我在底部添加的額外代碼建議,以簡化整個代碼 –
儘管在我的WordPress管理員中使用了不同的postAlign(Lsection等),仍然遇到一些問題,他們都使用文章-Fsection – user3550879