WordPress.org

Ready to get started?Download WordPress

Forums

Wondering how to achieve something, what plugin or coding for this... (3 posts)

  1. Sabinou
    Member
    Posted 1 year ago #

    Hello,

    I'm trying to find how to replicate the behaviour of a blog for my own website, however, I don't find the "trick" to do so, could I ask for your help, please ? :)

    Take a look at http://www.grist.org , a news website using WordPress as a CMS.

    In the middle column, there are the excerpts of actual blog posts, belonging to all sorts of categories (their permalink stating grist.org/category-name/post-title ), excluding the posts belonging to the News category.

    In the left column, there are excerpts of news articles, belonging to the News category only (their permalink stating grist.org/news/post-title )

    This is this behaviour that I would like to be able to copy, all the posts save the News ones in the central column, and in the left column, only the News posts.

    I don't think this requires to be a coding ninja, however I fell short of keywords to search, I don't even know how to call this behaviour...

    Please, would you know how that can be achieved ? Thank you VERY MUCH if you can help !

  2. jnhghy
    Member
    Posted 1 year ago #

    Hi,
    I checked the site and the first idea that would come in my head was to create a child theme (so coding no plugin) and modify it so that will be 2 column page (if you look at http://www.grist.org it has a span with 150px width that holds posts from news and list) and for the span I would query posts from the 2 specific categories (news and list) ordering them by date and for the rest of the page I would exclude those 2 categories. If you consider to use this option then you'll have to decide what function you'll use to query the posts query_posts will always be an option but it is very debated you can also use get_posts.
    In both cases you'll have to build the span (news and list) column manually so you'll have to write some php/html/css code.
    Hope this info helps.
    Regards

  3. bbrooks
    Member
    Posted 1 year ago #

    Hi Sabinou,

    At Grist we actually have used a little code-fu to achieve this. What you see in the center column is not actually 'everything except' News, but instead everything we mark as 'Featured'.

    We created a special taxonomy ( i.e. categorization system ) that keeps track of which posts are 'featured', and then we use WP_Query to get only posts in that taxonomy.

    That is probably a little heavy handed for what you need.

    The following will get you all posts except for those in categories 12 and 34 for example:

    $posts = new WP_Query( 'cat=-12,-34' );

    From there you can use the examples on the WP_Query page to output the posts as you wish.

    You definitely need to know some PHP to accomplish this, but the examples in the wordpress docs will take you pretty far, so just give it a shot!

    Hope that helps,
    Ben from Grist

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.