The first time you posted this question, you were asked to put the code into a pastebin so it could be examined. That advice still holds.
Look into wp_query and make sure you reset the query after each loop or problems can come into play with posts not showing up or loops being combined and not will not work
Thread Starter
MYGM
(@mygm)
@vtxyzzy I did post the code and now checking back I see it asked me to use pastebin. Sorry about that, hope this helps-
http://pastebin.com/LNtSfEu3
Its a little messy, Ive been trying different ways to try to get it work.
Thread Starter
MYGM
(@mygm)
@vtxyzzy The 2 loops are to be on the category page template, so for any and every category the loops will show the posts in that category. So I need it to be dynamic and not set for any specific category. I tried a lot of different loops but I can only get the second loop to work which displays all the posts in a category.
Thanks for the suggestions, I use Dreamweaver majority of the times and notepad++ sometimes. Im going to check and replace the <? .
Ok, so any idea how can I get the first loop working?
Thanks
You did not answer question 1. Maybe I didn’t explain clearly enough.
You say you want the first loop to display the latest post in the category. Do you want to show the latest post on every page, or only on the first page if there are several pages of the category.
Another question: Is the latest post to appear the same as the other posts, or in a different format?
Thread Starter
MYGM
(@mygm)
Ok sorry I misunderstood the first question then. I would want it to show on every page since it will be in a featured section.
The latest post will appear styled differently. Im going to provide some screenshots to help give a better idea.
Thread Starter
MYGM
(@mygm)
That is probably much more than can be done in this forum. You may need to hire someone to do the work. You can post a free job request at jobs.wordpress.net
Thread Starter
MYGM
(@mygm)
@vtxyzzy Thanks for the help thus far but I dont think its too much.
I just need to figure how to make both loops work for category pages.
I know it possibly cant be that difficult. I see people use multiple loops all the time, and I’ve developed the site from scratch and used multiple loops on the home page. I just cant get the first loop to pull the correct post, because as of now it works, its just not pulling the correct post. Is there something Im missing in the first loop code?
If you say so!
I have no way to test this, but try changing this:
<?php $the_query = new WP_Query( 'posts_per_page=1' );
to this:
<?php $args = array(
'posts_per_page' => 1,
'paged' => 1,
);
global $wp_query;
$the_query = new WP_Query( array_merge( $wp_query->query, $args ) );
Thread Starter
MYGM
(@mygm)
OMG!!!!!!!!!!!!!!!!!!!!!! THANK YOU!!!!!!!!!!!!!!!!!!!!!!!!! Its finally working. I knew it had to be something I was missing.
BUT the only thing now is how do I get the second loop to not show the same article (most recent) ? Any idea on that? Thanks.
Replace this:
$the_query = new WP_Query( array_merge( $wp_query->query, $args ) );
with this:
$duplicate = 0;
$the_query = new WP_Query( array_merge( $wp_query->query, $args ) );
this:
<?php is_category( $category ); ?>
with this:
<?php $duplicate = $post->ID; ?>
and this:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
with this:
<?php if (have_posts()) : while (have_posts()) : the_post();
if ( $post->ID == $duplicate ) continue; ?>
Thread Starter
MYGM
(@mygm)
THANK YOU VERY MUCH!!!!!!!!!
If your problem has been solved, please use the dropdown on the right to mark this topic ‘Resolved’ so that anyone else with this question can see that there is a solution.