• Resolved Refine Graphics

    (@refine-graphics)


    Hi there!

    I’ve been referring to this Pods Documentation article to figure out [if][else] template structure for a CPT called careers.

    It all seems to make perfect sense, but my code seems to only display the [else] template part. It does this for each career. So, if I have two careers posted, it shows the “no careers” message twice.

    What am I doing wrong? ??

    [if career]
    	[each career]
    		<div class="careers" style="width:220px; display: inline-block;">
    		<h3>{@post_title}</h3>
    		<p style="color: #2c353c;">{@career_type}</p>
    		<p style="padding: 30px 0px;">{@post_excerpt}</p>
    		<a href="{@permalink}" class="more-link;">Apply</a>
    		</div>
    	[/each]
    [else]
    	<div class="no-careers" style="width:100%;">
    	<h3>No careers posted at this time</h3>
    	<p style="padding-top: 30px;">We're not actively hiring at the moment, please check back later.</p>
    	</div>
    [/if]

    Displayed on page with shortcode [pods name=”career” template=”Careers”]

    Thanks so much in advance for your help.
    -Laura

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Refine Graphics

    (@refine-graphics)

    So, it looks like I didn’t quite read the documentation properly. I see now that [if][else] is intended to be used for fields or taxonomies within a custom post type, not for displaying custom post types themselves.

    Is there no way to display something if there are currently no Careers published using Pods Templates?

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @refine-graphics

    Is there no way to display something if there are currently no Careers published using Pods Templates?

    Yes you can! The Pods shortcode supports a “not_found” parameter.
    https://docs.pods.io/displaying-pods/pods-shortcode/

    Cheers, Jory

    Thread Starter Refine Graphics

    (@refine-graphics)

    Hey thanks @keraweb, I tried that out.

    Got it to work showing a basic text message, so that’s great!

    Hoping to add some styling to this message. The docs say supports HTML, but every time I try to add HTML to the not_found message, it no longer works. Here’s my full shortcode:

    <div class=”careers-container”>
    [pods name=”career” template=”Careers” not_found=”<span style=”background: #f5f5f5; padding: 15px; font-family: allumi-std,sans-serif;”>No careers posted at this time. Please check back later.</span>”]
    </div>

    See anything that could be messing it up?

    Thanks again so much for your help!

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @refine-graphics

    You cannot use double quotes if you already use them for parameters.

    So it should be either:
    not_found="<span style='see quotes'>"
    Or:
    not_found='<span style="see quotes">'

    Cheers, Jory

    Thread Starter Refine Graphics

    (@refine-graphics)

    Ahh okay, thanks so much!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Using [if] [else] in pods template’ is closed to new replies.