WordPress.org

Ready to get started?Download WordPress

Forums

list posts also from a particular category but ignore other categories (2 posts)

  1. wpNewbie80
    Member
    Posted 5 years ago #

    Hello I will do my best to explain what I am trying to do..

    I am currently moving a website and turning it into a wp powered site. Therefore I am trying to recreate, as closely as possible, the content / structure from the old site in the new site.

    On the current site there is a section on the tutorial e-books offered for purchase on the site. At the bottom of each e-book's page, there is a list or articles, also on the site, that are related to the subject covered within the e-book. These are hard coded as the site is not database driven.

    I am trying to do provide the same list on the WP version. I have set up an e-book category, which includes all posts about an e-book's info etc.

    I also have categories for the different subjects that an e-book may cover. These will also contain posts that are not necessarily outlining e-books, but an e-book post, will also be in one of these subject categories.....is there any way to list the posts that are also in the same subject category but exclude other posts in the e-book category?

    ie if the e-book covers a tutorial on spreadsheets, it will also fall into the subject category of accounting & statistics..On the spreadsheet e-book's post, I would like to list the titles of other posts within the accounting & statistics category whilst not showing the titles of the other e-books.

    I know I could probably use if statements based on the title of the ebook to determine which subject category an e-book post is in but I would then have to update my code accordingly as and when new ebooks are added. Is there a more future proof way?

    Thank you for your time

    J

  2. wpNewbie80
    Member
    Posted 5 years ago #

    I think I have the code to do what I'm wanting, but I'm a little unsure about the multiple loops involved and if I should be rewinding etc. Am I right in thinking that providing my intended output is to show the 'guide book' post,including the meta info, and then show the list of other posts below everything else, ie in my code it is after the initial endwhile, I can just use query_post again without the need to rewind etc?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.