[Resolved] Dynamically Show 3 or 4 Posts by Page ID #

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Dynamically Show 3 or 4 Posts by Page ID #

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #33874
    Alan
    Participant

    I am using Genesis Blocks to display either 3 or 4 tours (CPTs selected by me as recommended tours) on over two hundred pages. This is a custom application that adds a lot of code to the blog posts, pages, and website. I am using WPSP grids created by me elsewhere on the site (see all destination and interest pages) and would like to know if I can dynamically create grids of 3 or 4 posts with WPSP. Right now, I have 77 WPSP lists and don’t want to add more. If I can do what I want dynamically, I can also reduce the list count dramatically.

    Here is an example of 3 tours created with Genesis Blocks. See Recommended Tours at bottom of post https://www.savacations.com/galapagos-giant-tortoise-23-interesting-facts/.

    Here is an example of 4 tours created same way. See Tours Featuring https://www.savacations.com/destinations/ecuador-tours-travel/ecuador-accommodations/hotel-dann-carlton-quito/.

    I want to know if I can create the same thing by just dynamically adding the page id numbers into a WPSP short code. I am already doing the same thing now (see FAQ, Weather, and Accommodations on the destination pages), but need to create a new list in WPSP to do it, which I want to avoid.

    Please let me know. Thanks,

    #33893
    elvin
    Moderator

    Hi Alan,

    You can reuse a single WPSP list and have it do different queries on each instance through shortcode.

    Here’s a list of examples you can do w/ shortcode.
    https://wpshowposts.com/support/topic/shortcode-parameters-documentation/#post-29167

    And you can do multiple instance of this throughout the site or within the same post.

    Say for example, you want to use list id 1234 on the same page but you want it to display different queries for each instance, you can do something like this:

    Here’s an instance where the list queries category with slug “humanities”
    [wp_show_posts id="1234" settings="taxonomy=category&tax_term=humanities"]

    Here’s an instance where the list queries sorted by post views in ascending order.
    [wp_show_posts id="1234" settings="meta_key=post_views_count&orderby=meta_value_num&order=ASC"]

    Here’s an instance where the list queries specifying post IDs to display:
    [wp_show_posts id="1234" settings="post_id=4403,3904,4002"]

    You can use these 3 shortcodes on the same page simultaneously and they will all display different queries. You don’t have to make multiple WPSPs assuming you all want them to have the same styling.

    #33913
    Alan
    Participant

    Elvin:

    That is exactly what I am looking for if I can order the posts the way that I want. The one that is most applicable is here [wp_show_posts id="1234" settings="post_id=4403,3904,4002"]. One issue that I can work around if I have to is that you need to choose ascending or descending order, and the posts are displayed (on the web page) accordingly (i,e, 3904,4002,4403 or vice versa). Even if you choose no order from the order by drop-down list I am not aware of how to display the posts in this order 3904,4403,4002. Is it possible to do this?

    Please let me know.

    Thanks,

    #33933
    elvin
    Moderator

    This attribute should work.

    [wp_show_posts id="1234" settings="post_id=3904,4403,4002&orderby=post__in"]

    #33936
    Alan
    Participant

    That works perfectly. Thanks!!

    #33938
    elvin
    Moderator

    No problem. Glad to be of any help. 😀

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