|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
Help Needed for latest post from a selected categoryHi,
is there any way to get the post title and content and other field like time, tag and others as a variable in loop? That means, i want the_content(), the_permalink() or whatever in the loop as a variable and want to show them by echo. is there any method? I didn't found :( Help me please. <?php while (have_posts()) : the_post(); ?> <h3><a href="<?php the_permalink() ?>"><?php the_title()?></a> <p><?php the_content()?></p> <?php endwhile; ?> -------------------------------------------- Best regard Tareq Hasan My Blog (http://tareq.weDevs.com) Follow me: (http://twitter.com/tareq_cse) _______________________________________________ wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
|
|
|
Re: Help Needed for latest post from a selected categoryThanks for the very fast reply. Your tips was great.
But i am sorry for not mentioning one thing. I am using this code in my plugin under a function. That doesn't work there. BTW, is there any easy way to get latest 5 post from 3 category like below? LATEST 5 POST FROM ===> UNCATAGORIES CATEGORY LATEST 5 POST FROM ===> TWITTER CATEGORY LATEST 5 POST FROM ===> WORDPRESS CATEGORY This is just an example. Thats what i want to do: listing posts from some categories with their title and trimmed content . -------------------------------------------- Best regards Tareq Hasan My Blog (http://tareq.weDevs.com) Follow me: (http://twitter.com/tareq_cse) _______________________________________________ wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
Re: Help Needed for latest post from a selected categoryIt's actually get_permalink(). Some methods alternatively have an argument
to prevent echoing, such as the_title_attribute('echo=0'). You also need to keep in mind filters and such. See also the note in the codex for the_content: http://codex.wordpress.org/Template_Tags/the_content#Alternative_Usage. Object buffering can always be used as well. On Wed, Oct 14, 2009 at 15:22, Sharon Chambers <sharon@...>wrote: > I've found most of the methods have corresponding get_* methods that allow > you to parse accordingly... > $content = get_the_content(); > $title = get_the_title(); > $plink = get_the_permalink(); > > > -----Original Message----- > is there any way to get the post title and content and other field like > time, tag and others as a variable in loop? > That means, i want the_content(), the_permalink() or whatever in the loop > as > a variable and want to show them by echo. is there any method? I didn't > found :( > Help me please. > > <?php while (have_posts()) : the_post(); ?> > <h3><a href="<?php the_permalink() ?>"><?php the_title()?></a> > <p><?php the_content()?></p> > <?php endwhile; ?> > > > _______________________________________________ > wp-hackers mailing list > wp-hackers@... > http://lists.automattic.com/mailman/listinfo/wp-hackers > wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
Re: Help Needed for latest post from a selected categoryThanks Buddies for the help
-------------------------------------------- Best regards Tareq Hasan My Blog (http://tareq.weDevs.com) Follow me: (http://twitter.com/tareq_cse) _______________________________________________ wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
|
|
Re: Help Needed for latest post from a selected categoryOn Wed, Oct 14, 2009 at 4:10 PM, Tareq Hasan <tareq1988@...> wrote:
> Thanks Buddies for the help Maybe you already got your stuff figured out but it sounds like you might not have a good grasp on the 'wordpress loop', a special while() structure you have to use on queries to have access to functions like the_permalink(). http://codex.wordpress.org/The_Loop That article explains the loop and gives examples of multiple loops (including getting specific categories). -- Jeremy Clarke | http://jeremyclarke.org Code and Design | http://globalvoicesonline.org _______________________________________________ wp-hackers mailing list wp-hackers@... http://lists.automattic.com/mailman/listinfo/wp-hackers |
| Free embeddable forum powered by Nabble | Forum Help |