You must Sign In to post a response.
  • Category: Blog and websites

    How to use conditional loop in wordpress short code?

    Have a query about conditional looping in WordPress? Searching for help online? Out ISC experts shall provide you guidance for this conditional looping.

    I am importing JSON data from another website for this I have installed JSON content importer plugin. To import json feed I have following short code in my page:

    [jsoncontentimporter url=jsonfeedurl]

    This code is working fine, and showing all data correctly. Now I want to show data related to specific store_name. Can I use conditional loop like while loop or is there any other method to do this?
  • Answers

    3 Answers found.
  • Loop is used in WordPress to display posts. The WordPress formats the post as per the criterion given in the code inside the loop. The code can be in PHP or even HTML.

    Conditional codes using if/ while syntax can be used inside the loop and it will act on the post as per specified criterion.

    An advanced user can give specific information about each post using the appropriate Template Tags by accessing the $post variable, which is set for the particular post while the Loop is running.

    Knowledge is power.

  • The loop is the part that begins with if and contains all the tags and markup used to generate the page. The default loop works perfectly well for most single-loop themes. For advanced designs with multiple and custom loops, more looping power is required. WordPress will provide four ways to loop:
    Default Loop
    Loop with query_posts()
    Loop with WP_Query()
    Loop with get_posts()
    These methods are useful in many situations. They share a lot of the same underlying functionality, and the query parameters are essentially the same. These four techniques enable simple loops, multiple loops, and custom loops in WordPress theme template

    always confident

  • Thank you all for your answer. I have got the solution from plugin developer by asking some queries to him. As per him I can use If else condition in pro version only. And in free version I can display selected data by using alternate method.

    [jsoncontentimporter url=jsonfeedurl oneofthesewordsmustbein="" oneofthesewordsmustbeindepth=2]

  • Sign In to post your comments