I have a page called Dashboard and would like to show the contents of say page A and B on the Dashboard page. I can achieve this with the following code but I only want to show partial content of A and B like snippets. How can I show this in exactly the same styling as it appears on page A and B ?
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. ?>
Page A shows the content with this code:
<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>
Thanks in advance
you can easily do this by post create 2 posts suppose A and B. it will generate id’s like 20,22 … and use this code in your pages for page A:
and similarly for post B with having id 22.
I am not extremest php coder. But i am trying it.
Here is the code you can do it by with php
explode
.In your page A or B just put an identifier for explode.
Like this :
And then your function is like :