• Resolved pk-71

    (@pauljohnknight)


    Hi

    I’m currently learning about custom post types, but all the articles I seem to come across are how to show custom post types within the main blog page etc. I would basically like to add a job posting / simple job board option to a website. Setting up the categories and tags for the custom post types seems relatively straightforward. Where will I learn how to create a second blog page though, where I can import these custom post types into a separate listing page. The site is already using the blog page for weekly industry updates etc so the job board will effectively need to be a second blog.

    Many thanks in advance for any help / pointers where to look.

    Paul.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz

    (@bcworkz)

    WP will display a separate custom post type (CPT) archive list simply by using the post type slug in an URL. If your CPT is “jobs”, a listing of jobs CPTs can be requested with something like example.com/jobs/. You can create special templates to handle archive and single jobs requests by correctly naming the template files. See:
    https://developer.www.ads-software.com/themes/basics/template-hierarchy/#custom-post-types
    https://developer.www.ads-software.com/themes/template-files-section/custom-post-type-template-files/

    In cases where the post type might be ambiguous, such as search or category requests, you will need to help WP resolve the ambiguity by using the “pre_get_posts” action to specify which post types to use in the post_type query var.

    If you have unique needs that go beyond the usual WP templates, perhaps an interactive cascading job filtering page for example, you should consider a custom page template that contains all the special PHP code you need to to make this happen. When one requests a page based on this template, the template code is executed, whatever it may be.

    Thread Starter pk-71

    (@pauljohnknight)

    Thanks very much for the above.

    So when you got to a normal blog page on WP, and you’re faced with a list of posts – is that page known as an archive page? What I’m struggling to understand is what an archive page does? The word archive insinuates old/redundant/not in use anymore, as in when you archive old information.

    Moderator bcworkz

    (@bcworkz)

    Yeah, I’m afraid some WP terminology is ambiguous and confusing. A WP archive is merely any list of posts, regardless of age or usefulness. An “archive” template merely displays query results in some sort of order. Depending on the theme, it may be a grid instead of a list. The “archive” term comes from the most generic listing template — archive.php. Most themes have more specific listing templates, but they usually resemble the basic archive.php in some fundamental way. A WP archive does not carry any of the usual connotations the English word “archive” does.

    When one goes to a site’s home page, assuming it is a blog listing and not a static front page, it’s specifically called the home page. The template tag is_home() returns true only in this case. Some themes have a special appearance for home pages. This is easy to do since a different template is used for home pages. Despite a different template, it’s often the case the list’s appearance is the same as that produced by the archive.php template. Besides the home page, any other list of posts will be based on the archive template or one of its more specific relatives, depending on the theme.

    Admittedly, I’ve applied the “archive” term too broadly because of the similarity between all list type views to the archive template view. I should probably use “list” instead of “archive” in many cases. In any case, there’s really only two kinds of WP views, multiple post archive list views and single post views. All else are variations of one or the other. My apologies for being confusing.

    Thread Starter pk-71

    (@pauljohnknight)

    That was really useful, thank you so much. I know the research itself and playing around with custom post types is going to be a bit of a journey, but that really helped in terms of the overall concept and terminology.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom Post Types’ is closed to new replies.