Support » Plugin: Custom Content Shortcode » IF and Variables

  • Resolved s1s2

    (@s1s2)


    Hi all. I’d really appreciate some help with the scenario below, as I can’t understand what I’m doing wrong:

    – Context:

    Custom post type “Articles”
    Custom post type “Companies”

    When I write a new article, I can specify a “company” for it, via an ACF relationship.

    On the page of each “company”, I want to show the list of all related articles, using this plug-in in the template.
    So the following appears on the “Company” page:

    ——————————————

    [set thiscompany][field title][/set]
    
    [loop type=post count=5]
    			
    [set companyinarticle][related acf_company][field title][/related][/set]
    	
    [pass vars]
    Passed variable "companyinarticle": {COMPANYINARTICLE}<br />  
    Passed variable "thiscompany": {THISCOMPANY}<br />      
    			
    [if pass='{COMPANYINARTICLE}' value='{THISCOMPANY}']
    <a href="[field url]">[field title]</a>
    [/if]
    	
    [/pass]
    	
    [/loop]

    ——————————————

    The two passed variables appear correctly in my two debug lines, but the IF condition does not.

    In fact, even if I simply say [if pass='{COMPANYINARTICLE}’]something[/if], nothing will happen.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Use:

    [if var=companyinarticle value='{THISCOMPANY}']

    Thread Starter s1s2

    (@s1s2)

    Thanks for the quick reply!

    I just tried, nothing happens.
    Even if I just try [if var=companyinarticle] nothing happens.

    The latter makes me think that the IF statement doesn’t pick up any passed variable, no matter the syntax.

    if works with vars.

    What happens if you add:

    ..
    [get companyinarticle]
    [if var=companyinarticle value='{THISCOMPANY}']
    ...
    Thread Starter s1s2

    (@s1s2)

    The get correctly displays the variable.

    I now know what is the problem: I’m publishing these CCS shortcodes inside a PODS template. PODS ignores most CCS shortcodes, but it processes the IF, probably causing the malfunction.

    I tried to publish the CSS shortcodes inside the actual company page, and everything works perfectly. Sorry for the trouble.

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