- This topic is empty.
-
AuthorPosts
-
June 30, 2013 at 10:56 pm #45988
softprinciples
ParticipantHi,
Hoping to get some guidance/assistance with an ability to promote WordPress posts within my theme (TwentyTwelve), so that they always appear on the front page of my site.
Unsure what is the best way to approach this but I was thinking of being able to “stamp” a post as “OUTSTANDING”, which then based off this stamp, would push this post to the top of the queue, i.e. front page.
Would appreciate if people could assist with either a plugin or post some code on how I would be able to achieve this within WordPress, using PHP.
So basically need to:
a) Work out how to stamp a post as “OUTSTANDING” ?
b) How to promote these posts, that are “OUTSTANDING”, so that they always appear on the front page of my blog, say for 24 hours?
Would appreciate any help on achieving the above.
Thanks.
July 1, 2013 at 1:08 am #141110chrisburton
ParticipantIf it were me, an easy way would be to create a category with the name “Featured” (or “Outstanding”) and output all articles within that category.
July 1, 2013 at 2:56 am #141112softprinciples
ParticipantSounds good Chris – will give that a go and come back to you.
Thanks for that.
July 1, 2013 at 3:00 pm #141170eristic
Participant**
$sticky = get_option ( ‘sticky_posts’ );
$args = array( ‘numberposts’ => 3, ‘post__in’ => $sticky );
$lastposts = get_posts( $args );
foreach($lastposts as $post) : setup_postdata($post); ?>“>
**You can also bring a sticky post forward to the front page with this bit of code. Just put it in the loop.
July 1, 2013 at 3:05 pm #141171eristic
ParticipantCan’t seem to format code. Sorry about that.
July 1, 2013 at 3:12 pm #141172chrisburton
Participant$sticky = get_option( ‘sticky_posts’ );
$args = array( ‘numberposts’ => 3, ‘post__in’ => $sticky );
$lastposts = get_posts( $args );foreach($lastposts as $post):
setup_postdata($post);
the_title();
the_excerpt();
endforeach;
@eristic am I missing something?July 1, 2013 at 5:24 pm #141190Senff
Participant@Chrisburton’s option works. Give those posts a specific category, and then on the home page run a query that shows posts that have that category assigned to it.
It won’t really put them to the top of your regular list though, it’s just an additional list. If you also list posts the “regular” way on your home page, then those special posts will appear there again as well (unless you add some code that filters them out again).
July 1, 2013 at 6:27 pm #141201eristic
ParticipantLooks good @chrisburton … Thanks!
July 4, 2013 at 12:00 pm #141550softprinciples
ParticipantThanks for your help guys – all good.
-
AuthorPosts
- The forum ‘Other’ is closed to new topics and replies.