[wp-hackers] get list of items in a category
Brian Fidler
fidler.brian at gmail.com
Wed Nov 5 06:41:13 GMT 2008
ok, this helps a little. what do I need to do to the following code so that
it only retrieves $cat=5?
$myquery = new WP_Query('News');
while ($myquery->have_posts()) : $myquery->the_post();
?><br><b><?php the_title(); ?></b><?php
the_content();
endwhile;
On Tue, Nov 4, 2008 at 10:56 PM, DD32 <wordpress at dd32.id.au> wrote:
> use the get_posts() function or instantiate a new WP_Query() and pass the
> category ID in.
> See the "[wp-hackers] Resetting after multiple loops" thread in here last
> week for many arguements as to which to use..
>
>
> On Wed, 05 Nov 2008 16:53:05 +1100, Brian Fidler <fidler.brian at gmail.com>
> wrote:
>
> Thanks. I'm putting the PHP directly into my page_news template. I'm just
>> trying to use Wordpress's existing conventions. Any help would be great.
>>
>> thanks!
>>
>>
>> On Tue, Nov 4, 2008 at 10:42 PM, DEVCES <devces at gmail.com> wrote:
>>
>> There is a plugin that allows you to execute a php script in a post /
>>> page
>>>
>>> http://wordpress.org/extend/plugins/exec-php/
>>>
>>> worked for me.
>>>
>>>
>>>
>>> On Tue, Nov 4, 2008 at 11:51 PM, Brian Fidler <fidler.brian at gmail.com
>>> >wrote:
>>>
>>> > This is a simple one but I'm pretty new to WP. I've set up a News
>>> category
>>> > and have created a special page template for news items. I want to
>>> display
>>> > a
>>> > list of items in the News category, ordered by most recent date first.
>>> What
>>> > WP function would I use? I'm currently using <?php
>>> > get_the_category('News');
>>> > ?> but it's not returning anything.
>>> >
>>> > thanks.
>>> > _______________________________________________
>>> > wp-hackers mailing list
>>> > wp-hackers at lists.automattic.com
>>> > http://lists.automattic.com/mailman/listinfo/wp-hackers
>>> >
>>> _______________________________________________
>>> wp-hackers mailing list
>>> wp-hackers at lists.automattic.com
>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>
>>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list