Support

Account

Home Forums Front-end Issues Trying to use fields assigned to a custom post type on my index page

Helping

Trying to use fields assigned to a custom post type on my index page

  • hello all, I have a custom post type called “services”. I want to use a card for each service on my home page populated with the title + image of each service custom post type.

    How do I set up functions to grab the custom fields from an individual “Service” custom post and display it on my homepage?

    I have the following Services within the CPT:

    Design
    Development
    Optimization
    Content Creation

    Thank you for any help!

  • You need to create a new query on your CTP https://developer.wordpress.org/reference/classes/wp_query/

    Then you loop over the results of the query, example is shown on that page as well, and show the fields from each post returned by your query.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Trying to use fields assigned to a custom post type on my index page’ is closed to new replies.