WordPress.org

Support

Support » How-To and Troubleshooting » Gallery layout from Custom Post Type

Gallery layout from Custom Post Type

  • Hi guys,

    I know that title is vague, and I’ll try my best to explain my issue.

    For some background, I have a Custom Post Type called “sale”. I use the WP featured image for the image output, and have various meta options (custom fields) to display the other data. The post editor box itself is not used.

    The end output is http://d.pr/3E5z .

    Now what I am trying to do is get a grid based gallery sort of layout to ‘list’ all the posts in the “sale” post type. Basically I want the WP featured image and post title to be listed, which would then link to the post. I would imagine I would do this with a page template.
    The final kind of functionality I am after looks quite similar to http://www.fbcattle.com.au/genetic_factory_sires.htm

    I hope that made some sort of sense.
    Conor

Viewing 4 replies - 1 through 4 (of 4 total)
  • How do use custom post type archives work? I have added ‘has_archive’ => true

    Chip Bennett

    @chipbennett

    Theme Review Admin

    Refer to Template Hierarchy

    For a CPT archive index template file, use archive-{post-type}.php

    (For reference, for a CPT single post, use single-{post-type}.php.)

    Hi Chip,

    Thanks for the reply.
    I have now got archive-sale.php working, so that /sale/ now displays a list of all the posts from the sale post type. However as the post editor itself is empty due to the use of Custom Fields, no content is actually displayed.

    Now the content itself doesn’t worry me, however I’m still unsure how to get the post thumbnails to display with the post on the archive page.

    Conor

    Chip Bennett

    @chipbennett

    Theme Review Admin

    Hey Conor,

    No need to call the_content(); just call the_post_thumbnail() directly, wherever needed inside the Loop.

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