Questions tagged [conditionals]

For questions that use logic to display or hide parts of a page/template

Filter by
Sorted by
Tagged with
1 vote
3 answers
24 views

Embedded template variables and conditionals?

In an upstream template, I do this code : {embed="templatecategory/template" varA="{var1}" varB="{var2}"} These variables are populated by a custom addon. And in the ...
Eastmarch's user avatar
0 votes
2 answers
23 views

Template variables conditions

Im on Expression engine 7 now. Im trying check template variable for condition. like so: {if site_logo_path != ""} <img src="{site_logo_path}"> {if:else} <h1>...
soulilya's user avatar
0 votes
1 answer
9 views

Possible to match conditional from multiple values?

I'm trying to display relationship field "members" from selected "events" if their "field" value matches a certain "query": {ev_members status="open|other&...
Keith's user avatar
  • 101
0 votes
1 answer
22 views

Conditionals within channel form custom_fields loop?

Trying to setup a public submission page/form using channel:form in ExpressionEngine 6.3.4, and the relevant channel has some fields that the user shouldn't be able to fill in/edit themselves, as I'll ...
StephenB's user avatar
0 votes
1 answer
42 views

IF conditional not working with Relationship fields in Fluids

When using a Relationship field with a Fluid field type the current_field_name variable can be printed out for debugging just fine, but IF conditionals don't work when using current_field_name. {exp:...
lars.schwarz's user avatar
0 votes
1 answer
53 views

Simplify segment conditional documentation

Exist an interesting method to simplify a multiple conditional: If you want to execute the code when url_title not equal to "portfolio" neither equal to "photos" use this condition: {if segment_2 != ...
Stéphane's user avatar
  • 885
1 vote
1 answer
169 views

Relationship Field Conditional Not Working

EE 5.2.2 I have a homepage channel with a primary entry that handles a bunch of stuff on the homepage. One of the things it has is a relationship field called featured movie that can have just one of ...
Shayne's user avatar
  • 317
0 votes
2 answers
39 views

Channel Videos - Display if video exists

Confused as to why this does not work (EE5). I have a Channel Videos field named {p_vids}. In my template, within the channel:entries I have the below, but it doesn't display the video/code. (...
ZEDG's user avatar
  • 55
0 votes
1 answer
28 views

Setting up Fields and Logic

I’ve got a filtered portfolio project where the user will be able to add images or videos which pop up (like an overlay) without directing to another page. The user can also opt to add text content ...
Christian's user avatar
0 votes
1 answer
159 views

Issue with fluid fields and conditionals

I have migrated a channel to using a fluid field instead of the old setup of one body field and one extended text field. The fluid field includes a textarea and a grid field that of course can be used ...
Linda Antonsson's user avatar
0 votes
3 answers
25 views

Display different content if the base-domain contains ".uk" or ".co"

{exp:channel:entries channel="homepage_banner" orderby="{ban_strt_date}" sort="asc" status="open" limit="5" url-title="{site_url}"} {if url-title *= ".uk"} <div ...
user3702762's user avatar
2 votes
1 answer
57 views

'If' conditional statement not working, returning PHP error

I am using EE v2.5 and following the documentation from https://docs.expressionengine.com/v2/templates/conditionals.html I am trying to create an If Statement where if the Channel field labelled '...
Beans Dev's user avatar
1 vote
3 answers
50 views

Matching more than one segment

Matching one URL segments always works fine but is possible to match more than one? For example this works: {if segment_2 == "page"}nav-expanded nav-active{/if} But this does not: {if segment_2 == ...
nibb11's user avatar
  • 47
3 votes
1 answer
50 views

EE3 - When image description is blank, use title field

I'm running into a roadblock here. Basically my client wants to use the "description" field of a file as the alt text, unless it isn't filled out, then he wants it to fall back to the page title. I am ...
Andrew Parroccini's user avatar
0 votes
1 answer
28 views

Visitor (from DevDemon) - How to logout upon conditionals?

I'm using Visitor (for EE v3) and would like to know if there is a way to use the {exp:visitor:logout return="/mytemplategroup/mytemplate"} within conditionals? Because the tag is triggered as soon ...
pikarge's user avatar
  • 43
0 votes
1 answer
33 views

{order_total} conditional {if order_total > 100}

I want to offer manual payment option only if cart total amount is above 100,00 but {if order_total > 100} doesnt seem to work. Any sugestions anyone?
Bart's user avatar
  • 21
2 votes
1 answer
103 views

How to detect an AJAX request in a EE4 template?

What's the best practive to detect an AJAX request in EE4 without activating PHP in the template? With the previous version of EE, I used the Ajax Detect Conditional ({if ajax}, {if not_ajax}) from ...
Nikolai's user avatar
  • 23
0 votes
1 answer
23 views

Conditional Not Working as Expected.

I have a series of performance dates; let's say 5. {performance_date_one format="%l, %F %j, %Y; %g:%i %a"} However, after a date has passed, I want to gray the date out and remove the link, but ...
seeingis's user avatar
  • 325
2 votes
3 answers
114 views

Why is the OR not working in a conditional statement?

Running EE 3.5.15 I am trying to show content based on URL segment and the following is not working correctly: {if "{segment_2}" != "portfolio" || "{segment_2}" != "photos"} <p>Conditional ...
forrest's user avatar
  • 1,068
1 vote
1 answer
107 views

Checking if date field variables exist in templates

I'm having a strange issue where I can't seem to determine whether a standard date field in EE2 contains data. For the date variable {birth_date}: {if birth_date} Do stuff {/if} In my code, this ...
Russ's user avatar
  • 13
1 vote
1 answer
57 views

Problem with category conditional

I always seem to run into some problems with conditionals. The code in question is this: {categories} {if category_id != "305|325"} Index version 1 {/if} {if category_id == "305|325"} Index ...
Linda Antonsson's user avatar
1 vote
1 answer
166 views

conditional statement with radio button value

I'm not sure if this is an EE bug or if I'm doing something wrong. I'm looping through my "tournaments" channel entries and for each entry I'm looping through a "teams" channel that has a ...
Chief's user avatar
  • 117
1 vote
1 answer
143 views

Conditional on select dropdown field type not working

I have a select dropdown field with 2 values "yes" and "no". I want to display an entry when the "yes" is selected. Ive done this many times before but now I can't get it to go. It shows just one ...
Kippi's user avatar
  • 295
0 votes
1 answer
61 views

Show different content based on url segement

Sorry if my title is a little confusing. Here is my dilemma... I have a product category page with different products. I'm trying to figure out a way to say {if segment_3} show the product specific ...
Payton Burdette's user avatar
0 votes
1 answer
21 views

Conditional. Prioritize one field over another if both exist

Cannot seem to work this out! I have two fields, one is an image {e_image} and the other is plain text {e_map}. Both of these display a div in the exact same spot. What I want, is if an image is ...
ZEDG's user avatar
  • 55
0 votes
1 answer
77 views

Grid Conditionals - side by side fields - only display if field filled

Perplexed how or if this can be achieved. I have a grid field e_contact that consists of three field/columns: Name   Phone   Email {ename}   {ephone}   {eemail} My code ...
ZEDG's user avatar
  • 55
0 votes
1 answer
46 views

Conditional with "&" in comaprison string fails

EE 2.9.2, Structure 3.3.17 In running a conditional to compare a page title and it's Structure parent, the conditional returns false if there is "&" or any other punctuation in the string. {if ...
Jim Wyse's user avatar
  • 1,987
2 votes
2 answers
158 views

Showing Expired Entries Only. Not working

I want to show previous concerts (past concerts) under a special tab. I only want to show past concerts, not current or upcoming concerts that is under a different tab. I tried the following code. ...
seeingis's user avatar
  • 325
3 votes
1 answer
104 views

EE: Show previous 3 blog entries prior to the current viewed entry

I have been stuck on this one for a few days now: Page Content: Main blog post (current entry) + a sidebar displaying the previous 3 blog entries Sidebar Code: {exp:channel:entries channel="blog" ...
Michael Connolly's user avatar
2 votes
3 answers
76 views

Need a Conditional for Tally

I'm using the Tally add-on to display a total from a custom field I have that stores numeric values. It's working great, my only problem is that I need a conditional setup that will display 'your ...
Andrew Currie's user avatar
0 votes
1 answer
63 views

Conditional statement using two different channels

I have two channels setup, one "blog" and one "authors". The blog channel has all of the blog post entries and the Authors channel has a list of the different post authors. I am looking on a ...
C. Denkers's user avatar
0 votes
1 answer
58 views

How do I make content conditional on domain name?

I am wrapping up an MSM build that has one domain and three subdomains. Each site has unique Analytics code. Conditional code based on segment is very useful but I am not sure how to display ...
forrest's user avatar
  • 1,068
0 votes
1 answer
128 views

Conditional with categories

So I'm trying to conditionally display an embed within an entry based on several parameters: channel_short_name and category. So I have a conditional that checks a few items and then if it matches has ...
James's user avatar
  • 33
0 votes
1 answer
50 views

Displaying Channel Form based on member group, number of entries/channel within a date range

I am trying to run a conditional which displays a "can't post" message if the member of a group_id 1 had previously posted 2 entries in a channel. Otherwise, it displays a channel form to post an ...
Noor M's user avatar
  • 98
0 votes
1 answer
90 views

Q re: nested conditional with grid rows

I've got a Grid field (EE2.11) where one of the columns is called "Open?" with a checkbox for "Closed" so I can turn a row off and on. I'm using a nested conditional to first filter out anything that'...
edward's user avatar
  • 152
1 vote
3 answers
167 views

Setting a Stash variable within an old style EE conditional

I'm working on an old EE site (v2.5.2) which for reasons I won't go into I cannot update to a newer version. I am trying to set a Stash variable based on whether or not a condition evaluates to true. ...
foamcow's user avatar
  • 7,176
0 votes
1 answer
36 views

Conditional within solspace calendar tag

I am encountering a strange (to me, but maybe I'm missing something) bug when attempting to use conditionals to distinguish between users in the Solspace Calendar tag. As you can see from the code ...
K. Matt's user avatar
0 votes
1 answer
95 views

Limit conditional results inside of channel entry

I have a channel entry that I want to display limited results and also only show results with a certain conditional applied to it. Right now I am opening the channel entry and setting a limit inside ...
j_lemon's user avatar
1 vote
1 answer
37 views

modulo inside stash list

I have a stash list for displaying entries. In general a row has 3 columns, but I also want to break with rows of 2 columns. layout looks like: 30%|30%|30% 30%|30%|30% 50%|50% 30%|30%|30% 30%|30%|30%...
Thomas Hartmann's user avatar
0 votes
1 answer
52 views

Stash parse categories and category_id

I'm trying to use the following conditionals in exp:stash:parse to set some values based on the category_id. However, I just can't get it to work and it always just gold for channel_colour or 20 for ...
doubleplusgood's user avatar
0 votes
1 answer
145 views

Date conditional for over test if over 2 years

Haven't used EE in a while and having a brain freeze on best way to do a date conditional. I have a date custom field for a DOB. I want to conditional show items if the person/child is over 2 years ...
shorn's user avatar
  • 1,007
0 votes
1 answer
108 views

Does EE3 support preload-replace with conditionals in grid fields?

I keep running into issues using preload-replace with conditionals that are in a grid field. I have the preload: {preload_replace:staticchannelslug="gp"} And am trying to use it like so: ...
ByteMyPixel's user avatar
1 vote
1 answer
60 views

Conditional if else Problem

I have an additional title called {long_titles}, but do not use it for every entry. However, when I do use it, I want to suppress the {title}. I have tried several approaches but can't get it. Needs ...
seeingis's user avatar
  • 325
1 vote
2 answers
66 views

Logged out redirect not working for cartthrob:add_to_cart tag

I have add to cart buttons like this: <a href="{entry_id_path='weekend-courses/add-to-cart'}" >Book now</a> 'weekend-courses/add-to-cart' contains only this: {if logged_out} {redirect=...
Tim Print's user avatar
  • 234
0 votes
2 answers
61 views

404 Redirect when there are too many segments

Having some issues forcing a 404 redirect when there are too many segments. Here is the page I am working on http://syntropy.highimpact.com/case-studies/aurora-flight-sciences/ I'm using the ...
Micah Kohne's user avatar
0 votes
3 answers
61 views

display last 6 entries in a channel

Have events channel have 10 entries (the channel can have varying range of entries for example it has 10) have a date field called event_start_date ex. current date is 2016-05-30 Desire - ...
Lacer's user avatar
  • 127
0 votes
1 answer
49 views

'IF' Conditional Not Working

I want to set up a conditional that when correctly running will post a 'widget' on the sidebar based on the entry. I have eight events (concerts) and three venues. On the individual detail page, I ...
seeingis's user avatar
  • 325
0 votes
2 answers
141 views

conditional statment to display all entries that are from today and forward

Have events channel have 10 entries have a date field called event_start_date Desire - display only up coming events in asc order List 2016-12-06 2016-11-01 2016-10-24 2016-05-30 2016-09-12 2016-...
Lacer's user avatar
  • 127
0 votes
1 answer
96 views

Conditional statement error inside relationship field

I have a relationship problem and I figured Stack Exchange can help ;) I'm using the standard relationship field in EE 2.8.1 but the conditional statement just keeps throwing an error; {...
doubleplusgood's user avatar
0 votes
1 answer
44 views

if statements that can alter a layout

Im working on a project where there are two divs next too each other (not worried about the styling for now) but my question is the following. div 1 | div 2 if there's no channels fields in div ...
Lloyd_07's user avatar

1
2 3 4 5
7