• Resolved commontater

    (@commontater)


    Question: How do I display 1 post (the most recent or the sticky post) from a category, with the featured image, similar to the way WP Show Posts does it?

    I see that WP Show Posts is being set aside for the GenerateBlocks “Query Loop.” I’ve read the docs for Query Loop, and frankly, the instructions threw me for a loop. Tried some stuff and ended up with scary results on my site’s home page. ?? First, it says I need to have already added a Container block, and then I guess I pick the two-column with featured image, and then I get all of the posts, and I don’t know how to get anything more targeted than this. I took it off the site so that it wouldn’t mess up the rest of the page.

    Can someone please lay out some steps for this?

    Many thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support ying

    (@yingscarlett)

    To display 1 post, you just need to change the posts per page to 1, instead of the default value 10.

    Thread Starter commontater

    (@commontater)

    Hi Ying,

    Thanks for replying. I don’t understand how to set up query loop to do what I want. I don’t see how to even get it started on the page. I know I need to change posts per page to “1” but I need a bit more instruction to get the block set up. The documentation is not helpful to me. The directions don’t make sense. Not enough detail about getting started, and then some mention of pagination (which I won’t need, obviously).

    Can you describe step-by-step how to set it up, and then how to display 1 sticky post? Do I need to create a category, and if so, where would I add that info to the block?

    Many thanks!

    Plugin Support ying

    (@yingscarlett)

    1. add a query loop block, you can choose from the pre-built templates, or choose blank to build your own layout, i would recommend go with the “two columns & featured image.
    2. when 2 columns are selected, it will output a query loop with 2 columns of posts, if you want to change the column number to 1, select the Post template block, set width to 100%, if you want to have 3 columns, then set the width to 33.3%, etc.
    3. set post per page to 1 to show only the latest post, but if you have multiple sticky posts, it will show all sticky posts and the latest post instead, this is the default behaviour of the core query loop block as well.
    4. if you only want to show the latest sticky posts, add the parameter sticky posts, then choose only.

    Let me know if you have other questions.

    Thread Starter commontater

    (@commontater)

    Thanks for this. I will try it out and get back to you with the results and let you know if this solves my issue.

    ??

    Plugin Support ying

    (@yingscarlett)

    No Problem ??

    Thread Starter commontater

    (@commontater)

    Hi @yingscarlett – I finally got a chance to try the instructions you provided and was able to set up the query loop block to do what I needed.

    Thanks for your help!

    Plugin Support ying

    (@yingscarlett)

    You are welcome ? ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.