Hi guys quick query,
I am building a site for a travel company. I have made parent categories for the Main countries then each parent category has a child category for individual trips.
My plan was to have the post in the parent cat to outline the country etc then at the bottom pull in excerpts of 5 posts in its child cat.
Anyway iit does this fine pulls in the child Image and Title perfect. However the excerpts for each child post is the content from the parent post so Im a little baffled if you like. Heres a page so you can see what I mean -
Scroll down to the some suggested itineries and you will see what I mean.
Heres the code Im using to pull in the child cat content into the parent cats post :-
[ Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum's parser. ]
<?php global $post; $categories = get_the_category(); $category = $categories; $cat_ID = $category->cat_ID; $myposts = get_posts("numberposts=5&category=$cat_ID&exclude=107,78,64,203,206,208,210,213,215,217,219,221,223"); ?> <?php foreach($myposts as $post) :?> <div class="image-tab-post"> <?php the_post_thumbnail('width:170px' ); ?></div> <div class="content-tab-post"> <strong class="title"><a>"><?php the_title(); ?></a> <?php the_excerpt(); ?> </div> <div class="clear"></div> <hr/> <?php endforeach; ?>
Now I may have done a backwards way, Im not godlike in wordpress but hope to be one day so any constructive criticism into how Ive done it is also welcome.
Any help would be awesome,