Forum Replies Created

Viewing 12 replies - 61 through 72 (of 72 total)
  • Hi Andrew, could you explain what you mean when you say that you want to “show ‘active’ terms only”? It seems that your issue here is that you’re not following the proper syntax for the If tag. Dynamic tags should always be capitalized (you’ve done that for your Loop but not If) and taxonomy and name are not valid attributes for the If tag. If you can elaborate a bit about what you’re trying to do, I might be able to suggest what the correct approach might be.

    At first glance, it seems like you’re trying to filter your loop to only show certain posts, so it would probably be more efficient to use some of the post loop’s query parameters to filter your query instead of nesting an If tag inside your Loop. You might write your Loop like this:
    <Loop acf_relationship=client_projects taxonomy=stage terms=exists>
    but that really depends on what you’re trying to do here when you mention showing “active” terms.

    • This reply was modified 2 years, 7 months ago by Ben @ Team Tangible. Reason: Fixed some formatting

    Hi Besim, it seems that the behaviour you’re noticing is a compatibility issue caused by the Custom HTML widget in Customizer loading a library called HTML Lint, which is used for validating syntax in the code editor. The Tangible Template field type (which L&L registers as a custom ACF field) loads its own HTML Lint, but a different version. Where this seems to be causing a problem is that ACF apparently loads all field types’ JS/CSS files on Customizer screens, even when the field type is not used.

    We’ve identified a solution that will resolve this in an upcoming update. The next release of L&L will likely focus on a restructuring of the plugin to pave the way for our eventual third-party integration add-on for L&L, but I expect that the version after that will include a fix to this issue. Thanks for providing so much feedback to help us get to the bottom of this!

    Thanks for the thorough clarification! I’ve sent you an email.

    I’m not an expert in the matter, but a quick search seems to show that there are plugins for finding shortcodes used on your site such as this one. Hope that’s helpful!

    Hi Chuckie! You can take a look at this blog post for a more thorough answer to your question, but the short answer is that, unfortunately, Loops & Logic isn’t just a plug-and-play replacement for Custom Content Shortcode. Instead, L&L is more like a reimagining of CCS and uses an HTML-like syntax that’s a lot more flexible than what CCS’s shortcode-based syntax allowed for.

    The good news is that a lot of the query parameters you would have used in CCS are written the same way (or in a very similar way) in L&L. The other good news is that while CCS was only able to work with specific parameters/attributes that were built into the plugin, L&L is an extension of HTML which means that it allows you to work with all the standard HTML tags and CSS styling workflows that are well-accepted and conveniently documented.

    If you decide to venture into the world of L&L, there are a some articles on the L&L blog that should help you get started. And if you ever run into issues, there’s a small but active community to help you troubleshoot your markup over on the L&L forum.

    I hope that answers your question!

    Hi Besim, apologies for how long this ticket has sat without a follow-up, I’ll see if I can take over for Eliot here and get this figured out. I’ve gone ahead and installed ACF Pro and L&L on a local multisite installation and when I add the “Custom HTML” block to the widget area of my main site it all works as expected. I’d love to try to figure out why this is happening for you so here are a few additional questions that might surface some info that’ll help us find the culprit:

    1. Does this happen with all HTML widgets regardless of what’s contained in them? In other words, if you create an HTML widget with markup that contains a single tag, does that still make things disappear?
    2. Does this happen on all sites in your multisite or only certain ones (maybe only the main site or a subsite)
    3. You mention that this occurs in a multisite environment. Are you able to replicate this on a non-multisite WordPress installation? Depending on where you’re working, this might be too tedious to test, but I thought I’d ask in case you’re able to clarify that
    4. Does this happen regardless of the theme that’s activated? If you’re unable to check this, what theme are you using?

    While I’m at it, I thought I’d mention that you might find the Loops & Logic forum to be a better place to get product support in the future. It’s a much more active community than this support in the WordPress plugin repository.

    Thanks for reaching out!

    Since you’re mentioning the count parameter, I assume you already know how to create a loop for your content, but if I’m understanding correctly you’re now wondering how to make the content from that loop appear in three columns, is that right?

    If so, I have bad news and good news. The bad news is that there’s not (currently) a simple parameter that automatically places content into neat columns. That might be added in the future, but I don’t believe it’s on the short-term roadmap.

    The good news is that since L&L is just an extension of HTML, there’s no need to reinvent the wheel since you can easily use standard CSS solutions to style your content, probably either using flexbox or CSS grid. Those aren’t L&L-specific so you’ll find plenty of resources online about how to work with that if you’re not already familiar. There are also generators available online (like this one for CSS grid and this one for flexbox) if you’d rather go that route. The CSS can be easily added to the Styles tab of your template or to your site’s global styles, whatever fits your workflow best.

    So in the end, the markup you’d write in your template would end up looking something like this with a my-post-grid CSS class (or whatever you decide to call it) that’s styling your content into three columns:

    <div class="my-post-grid">
      <Loop type=post count=9>
          Here's where you'd add some dynamic tags indicating what content you want to display like <Field title /> along with standard HTML tags to structure your post grid.
      </Loop>
    </div>

    I hope that gets you going in the right direction! We’re working on putting together more L&L markup examples to add to the documentation but in the meantime, you might find some of the posts on our blog useful as you’re learning the L&L ropes.

    While I’m at it, I thought I’d mention that you might find the Loops & Logic forum to be a better place to get product support in the future. It’s a much more active community than this support in the WordPress plugin repository.

    Forum: Plugins
    In reply to: [Loops & Logic] List Loop

    I just realized that my markup above wouldn’t work since it’s comparing the entire racing list against the current content_name field. Guess I didn’t think that one through all the way.

    If you end up testing the two other points I suggested in my earlier post, let me know what you discover from that! I’m still not able to replicate the issue, but maybe with a bit more information about what kind of data your post loop is getting “contaminated” with, @miyarakira might be able to make some suggestions.

    Forum: Plugins
    In reply to: [Loops & Logic] List Loop

    Ah ok, so the part that doesn’t work about my approach is the order of the If statement since your racing list term is in the content_name field, but not vice versa (the content_name field isn’t in the racing list term). Would reversing the order of my If statement work while also not requiring you to change your whole code? So something like this:

    <Loop acf_repeater=page_content>
      <If check="{Get list=racing}" in value="{Field content_name}">
        <Field content_text />
      </If>
    </Loop>

    If that still doesn’t work, let me know what you learn from testing the other three things I suggested, it might surface some valuable information about why your particular site/installation/data structure seems to be causing issues but mine (a very vanilla WP install) works as expected:

    1. Check whether changing the this_term variable name has any impact. (I imagine it won’t but it’s worth a shot)
    2. See what’s in common between your list items and the pages from which you’re accidentally getting field data. Is the issue here that when your list item name matches a page name, the acf_repeater loop is for some reason looping through the fields from that matched page instead of the current page?
    3. Check whether your markup only works when you set and overwrite the _trash variable you made or whether simply having an empty <Loop acf_repeater=page_content></Loop> loop before the list loop is enough to make your markup work.
    Forum: Plugins
    In reply to: [Loops & Logic] List Loop

    I just noticed that in your reply you mentioned that my markup did not work on your site, which seems especially odd. What part of it didn’t work? My markup shouldn’t be affected by a change in loop context since it’s just a single loop with a conditional statement. If you use this part of my markup without the List tag or anything else, are you able to successfully output some of your acf_repeater fields?

    <Loop acf_repeater=page_content>
      <Field content_name />
      <Field content_text />
    </Loop>

    If not, then that seems like it’d simply be indicative of either incorrect ACF field names being referenced in the L&L markup or a pretty fundamental problem with the acf_repeater loop in your particular use-case.

    And one other thought: does your markup only work when you set and overwrite the _trash variable, or does simply having an empty <Loop acf_repeater=page_content></Loop> loop before the list loop also make your markup work? It seems strange that setting and wiping an unused variable would have any bearing on the rest of the markup so I’m trying to better understand in what contexts your markup works or doesn’t work.

    Forum: Plugins
    In reply to: [Loops & Logic] List Loop

    Hmm, that’s interesting. I was initially wondering if the issue you were describing was a result of the loop context changing once you’re inside a list loop, just as you hypothesized. But I tested that (I made an acf_relationship loop nested inside a list loop) and the inner acf_relationship loop was successfully able to get fields from the current page. You’re saying that on your site, that’s not happening and you’re instead getting fields from some other pages.

    I might be completely wrong on this, but I wonder if your variable named this_term happens to be conflicting with some other variable on your site. Maybe you could try changing that to something that’s more obviously unique.

    If that doesn’t change anything, I think the biggest clue as to why it’s working for me and not working for you is that, as you mentioned, you’re “getting back fields from pages called racing, etc.” Are you able to see what’s in common between your list items and the pages from which you’re accidentally getting field data? Is the issue here that when your list item name matches a page name, the acf_repeater loop is for some reason looping through the fields from that matched page instead of the current page?

    These might be dead ends, but I figured it’d be worth a shot since the fact that it works on my little test site but not your site suggests that the culprit might be some conflicting data on your site.

    Forum: Plugins
    In reply to: [Loops & Logic] List Loop

    I’m not sure why the markup you’ve written doesn’t work, so a more experienced dev would need to chime in here to confirm what’s happening in your case.

    I wonder if you’d be able to achieve the same result by using the list variable as the value of a conditional statement using the in comparison. The only difference I could see with this approach in contrast with yours is that with my approach the order of the items being looped through would be set by the order of the ACF repeater fields as opposed to your markup where the order of the “racing” list is what sets the order. If that difference doesn’t matter to you, then maybe you could adapt something like this to work on your site:

    <List name=racing>
      <Item>item_1</Item>
      <Item>item_2</Item>
    </List>
    
    <Loop acf_repeater=page_content>
      <If field="content_name" in value="{Get list=racing}">
        <Field content_text />
      </If>
    </Loop>

    The nice thing about this markup is that it’s just a single loop and doesn’t involve setting a new variable for each instance of the outside loop as you’re doing in your markup. I just checked both methods using the Timer tag and the markup above is about twice as fast as your nested loop solution.

    Sorry that I can’t explain why your method only works when you add that dummy _trash loop/variable, but hopefully this alternative method works for you and results in better performance anyway.

Viewing 12 replies - 61 through 72 (of 72 total)