• Resolved metrosuperstar

    (@metrosuperstar)


    Hi, I’d like to show only the LATEST post that I’ve created in Divi’s “Projects” custom post type. All other plugins force me to use a widget area but since yours uses shortcode, I’m hoping to overcome the limitation. However, other plugins offer an easy UI where I can just check some boxes but I don’t think yours does. So I’m writing to ask you what is the syntax to only show the latest custom post type? I looked thru the documentation under query parameters but could not find the formula to show only one (most recent) post. Please assist…

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter metrosuperstar

    (@metrosuperstar)

    OK I was able to show only the latest post HOWEVER the category_display toggle is not working for custom post types I think, as I cannot get the category to show along with the title and image.

    Is this possible? That category_display will only work for the standard post types?

    Plugin Author Bill Erickson

    (@billerickson)

    Thanks for the message.

    You can control the number of posts shown using the posts_per_page parameter. To see the latest post, use [display-posts posts_per_page="1"]

    I’m guessing your custom post type is using a custom taxonomy for its categories. In your site’s backend go to Projects > Categories and look at the URL to see the actual taxonomy name.

    On a site I’m working on, we have a “Reports” post type and a “Report Tags” taxonomy (screenshot). I would use the following shortcode to display the most recent report and include its tags:

    [display-posts post_type="report" category_display="report-tags" posts_per_page="1"]

    Thread Starter metrosuperstar

    (@metrosuperstar)

    OK fantastic! By going to the “Categories” page for the Projects post type I saw in the URL that the taxonomy term is called “project_category” so using your formula I was able to make it work! So now it says the title then it says “Posted in:” and the category.

    You have great documentation but I was not able to find how to change or remove the autogenerated “Posted in:” text to say something else?

    digestsua

    (@digestsua)

    [display-posts category_display=”true” category_label=” “]

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to show ONLY the latest custom post type?’ is closed to new replies.