Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Promoting Posts in WordPress to the Front Page

  • This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #45988
    softprinciples
    Participant

    Hi,

    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.

    #141110
    chrisburton
    Participant

    If 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.

    #141112
    softprinciples
    Participant

    Sounds good Chris – will give that a go and come back to you.

    Thanks for that.

    #141170
    eristic
    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.

    #141171
    eristic
    Participant

    Can’t seem to format code. Sorry about that.

    #141172
    chrisburton
    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?

    #141190
    Senff
    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).

    #141201
    eristic
    Participant

    Looks good @chrisburton … Thanks!

    #141550
    softprinciples
    Participant

    Thanks for your help guys – all good.

Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘Other’ is closed to new topics and replies.