我有一個名爲Dashboard的頁面,並希望在Dashboard頁面上顯示說A頁面和B頁面的內容。我可以用下面的代碼實現這一點,但我只想顯示部分內容的A和B像片段。如何以與A頁和B頁上顯示的樣式完全相同的樣式顯示?如何在wordpress中顯示另一頁上的部分內容?
function show_post($path) {
$post = get_page_by_path($path);
$content = apply_filters('the_content', $post->post_content);
echo $content;
}
<?php show_post('pageA'); // Shows the content of the "PageA" page. ?>
<?php show_post('pageB'); // Shows the content of the "PageB" page. ?>
頁A顯示了這種代碼的內容:
<ul class="leftlist">
<?php
while ($loop->have_posts()) : $loop->the_post();
?>
<li class="todo" id="<?php echo get_the_ID();?>" itemage="<?php echo get_post_meta(get_the_ID(),'_todotime',true)?>"><a href="javascript:;"
<?php if($all_meta_for_user[get_the_ID()][0]){
?>
class="strike"
<?php
}
?>
>
<?php if($all_meta_for_user[get_the_ID()][0]){?>
<span class="check_box cb"></span>
<?php }else{?>
<span class="uncheck_box cb"></span>
<?php }?>
<p><?php the_title(); ?></p></a>
<?php
endwhile;
?>
</ul>
在此先感謝
你只是想借此從整個a或b頁面的一部分。它將顯示在儀表板頁面中。對 ? –
是的,只是其中的一部分而不是整個內容 – user2798091
好吧,讓我輸入一個鼻子 –