Wordpress & PHP Stuff

Hi guys, i´ve knoledge of html/css/±js and im just knew to wordpress&php stuff.

Im building my own template and im having so much trouble finding the information i need…and i hope someone could give me a light, heres the deal:

I wanna make a section of a page that filter the 5 most recent posts with categories of my wish.

Example: in this section it will show the most 5 recent posts within the categories “food” and “restaurant”. If theres none show a message and if theres more then 5 show a button like “show more” or something like that…

I know there´s a PHP code for that and im searching, made some tries but i cant get it to work…

Thank you already.

Assuming you are using Wordpress here is some code that should do the trick. Replace category ID’s with the ones you would like to be displayed though:

<?php $recent = new WP_Query(“cat=1&showposts=10”); while($recent->have_posts()) : $recent->the_post();?>
<li><a href=“<?php the_permalink() ?>” rel=“bookmark”>
<?php the_title(); ?>
<?php endwhile; ?>

Thanks for the fast reply @mike.fro but i want something a little more complicated, as my english fails i illustrated to show more accurately the idea!

Here it is:

Basically it wil show:

1: The Mother Category (if ti has one).
2: The Category.
3: The Categorie description (it is already defined when the categorie was created).
4: The posts that has both categories.

=X little complicated…

Something like this:

while(have_posts()) : the_post();
<li><h3><a href=“<?php the_permalink() ?>” rel=“bookmark”><?php the_title(); ?></a></h3>

[COLOR=#5D5D5D][FONT=Arial]<ul><li><?php the_excerpt(); ?></li>
<?php endwhile; ?>

This may take some tweaking on your end. But it should be enough to get you started. Let me know if I provided the wrong solution… again, hehe =P

Good Luck![/FONT][/COLOR]


Thank you very much, i made it!!! Of course the project has several pages, it will need a lot of time but the codes are working!


Yes, not a problem. Glad I could help. Like I said, it will take some customizing on your end to make it look however you’d like but the core is there for you to work with.


Yeah i made it, its working all good, hehe.

Thanks man.