Loops & Logic


Loops & Logic is a toolset that allows you to have extensive control over the display of WordPress content & data on your site’s frontend for when your theme or builder doesn’t have the options you need. This plugin gives you the power of custom PHP theme & builder module development using a simplified HTML-like syntax that will be familiar to any frontend developer.


Key Features

  • Use HTML templates with dynamic tags like Loop, Field, and If
  • Use theme location rules to apply custom templates to post types, taxonomies & more (similar to Beaver Themer or Elementor Theme Builder)
  • Easily enqueue your CSS stylesheets and Javascript anywhere using a visual location rule builder
  • Seamlessly write your CSS directly in SASS without worrying about compilation
  • Create query loops of any content type, such as: posts, pages, custom post types, attachments, users, taxonomies and terms
  • Display built-in and custom fields
  • Build logic to display things based on certain conditions, for example: creating a menu, with some links only for logged-in users, or by user role
  • Create custom shortcodes to display anything from a custom field to an entire dynamic-data driven web page

Example Usage

At the core of L&L is the ability to quickly and elegantly loop through WordPress data like in this example of displaying a list of links to the three most recent posts

  <Loop type=post count=3 orderby=date order=desc>
      <a href="{Field url}"><Field title /></a>

Accomplishing the same thing in PHP is a little more complex:

$args = array(
    'post_type' => 'post',
    'posts_per_page' => 3,
    'orderby' => 'date',
    'order' => 'DESC',
$query = new WP_Query( '$args' ); ?>
<?php if ( $query->have_posts() ) : ?>
    <?php while ( $query->have_posts() ) : $query->the_post(); ?>

        <a href="<?php the_permalink(); ?>">
          <?php the_title(); ?>

    <?php endwhile; ?>
<?php endif; ?>

It can be difficult to add PHP to your site if you’re not a backend developer, but L&L is a breeze to include, even in a page builder layout.

Page builders like Gutenberg, Elementor, and Beaver Builder often have gaps in their capabilities that would normally require you to either develop a custom add-on or purchase a bloated add-on pack just to get the one element you need. L&L adds a template editor module directly to each builder so that you can simply describe what you want to display in L&L code and place it using the builder interface. You can even copy-paste your L&L code between page builders if you work with more than one! It’s like having your own page builder addon factory.

Plugin & Theme Support

Plugin Support:

Loops & Logic works with the post types and custom fields added by most plugins, but plugins with special data structures like a custom tables or fields with data formats that need parsing require us to program explicit support.

Bundled integrations:

✅ Advanced Custom Fields (ACF)

L&L supports Advanced Custom Fields (ACF) field types in the core, allowing you to work with most of their field types out of the box! We also plan to support other WordPress custom field plugins such as Pods & Metabox in the future.

<Loop acf_flexible=field_name>
  <If field=layout value=layout_1>

    Layout 1
    <img src="{Field acf_image=field_name field=url}" />
    <Field acf_editor=field_name />

  <Else if field=layout value=layout_2 />

    Layout 2
    <Field acf_editor=field_name />
    <img src="{Field acf_image=field_name field=url}" />


✅ WP Fusion

The freely-included WP Fusion integration allows you to use conditional logic to protect or display different content based on a user’s tags.

<If user_field=wp_fusion_tags includes value="123">
  User has tag ID 123
<Else />
  User does not have tag.

We’ll be rolling out premium addons for popular plugins in the coming months, so check out our website to see what’s available!

Premium addons coming soon:

  • WooCommerce
  • Easy Digital Downloads
  • Modern Tribe Events Calendar
  • Gravity Forms
  • LearnDash
  • LifterLMS

Theme Support:

Everything will work with themes built according to WordPress standards.


Этот плагин предоставляет 1 блок.

  • Tangible Template


  1. Install & activate in the admin: Plugins -> Add New -> Upload Plugins


I needed a solution to build dynamic repeaters with my favorite page builder, which hadn't released support for loops yet. I've also been using L&L to tie up loose ends with other builders that can't handle complex dynamic showcases - and L&L merges perfectly with every builder I've tried, without ever glitching out. Now I'm finding myself wanting to go back to html and css with loops & logic because it makes theme building super clean - I could probably ditch every other page builder and use my own framework and build literally any type of site, especially that it supports woo & learndash. Talk about the ultimate flexibility! Support is also great and active - I look forward to the pro version
Love this plugin, it's made some trickier parts of my dev process really simple. The support over on discourse.tangible.one is incredibly helpful.
A very useful plugin. Thanks for making it.
I can't imagine using WordPress without Loops & Logic. I've replaced cumbersome page builder sections with simple and powerful L&L templates that work perfectly with ACF and CPT. The team is brilliant and unbelievably helpful. Thanks!
Now I can finally create my own dynamic websites! The possibilities are endless! And if you get stuck; the support is fast, professional and very comprehensive! From now on I will use Loops and Logic in as many projects as possible so that all content is clear and flexible.
As a WordPresser who slings HTML + Tailwind CSS, this plugin has been an absolute godsend. I can do complex queries in the front end, and can go further than any 'Posts Module/Block/Widget' UI could ever hope for. The fact that there’s only ~700 downloads at the time of this review is borderline criminal, but hey, I like to adopt the good stuff early 🙂 Dave Bloom
Посмотреть все 20 отзывов

Участники и разработчики

«Loops & Logic» — проект с открытым исходным кодом. В развитие плагина внесли свой вклад следующие участники:


Перевести «Loops & Logic» на ваш язык.

Заинтересованы в разработке?

Посмотрите код, проверьте SVN репозиторий, или подпишитесь на журнал разработки по RSS.

Журнал изменений


Release Date: 2023-02-01

  • Improve compatibility with PHP 8.2
  • Loop: Improve logic to set current post as loop context for templates loaded inside shortcodes and builder-specific post loops, such as Elementor Loop Grid widget and Beaver Post Loop
  • Plugin framework: Fix invalid hook name of ready action specific to module and version
  • Post Loop: Add alias «current» (same as «today») for parameter «custom_date_field_value»
  • Taxonomy Term Loop: Support multiple IDs for parameter «post»


Release Date: 2022-12-30

  • Loop: Improve getting default loop context for search results archive
  • Sass module
    • Upgrade compiler library to ScssPhp 1.11.0
    • Improve compatibility with newer CSS features such as variables, functions, selectors, media queries
    • Improve compatibility with PHP 7 and 8
    • Improve error handling
    • Remove Autoprefixer and its dependency CSS Parser; Internet Explorer no longer supported
    • Improve passing Sass variables — Handle all known value types to be compatible with new compiler
    • Convert any compiler error message to CSS comment
  • JavaScript and Sass variable types: Make default value type «raw» (unquoted) instead of «string» (quoted)
  • Template post types


Release Date: 2022-10-05

  • Calendar loop types
    • Improve handling in case invalid values are passed
    • Week loop: Correctly handle January which can have a week row that starts in the previous year
  • HTML Hint: Add exception for Shortcode tag to allow self-closing raw tag
  • Loop and Field tags: Get current post context inside builder preview when post status is other than publish
  • Template editor: Improve compatibility with Beaver Builder’s CSS


Release Date: 2022-09-13

  • ACF select: Support looping field with single select value
  • ACF image url field: Support size attribute
  • Add feature module: Mermaid — Diagram library
  • BaseLoop: Add sort_date_format parameter when using sort_type=date, to convert from date format to timestamp for sorting
  • Compatibility with PHP 8.1
  • Compatibility with WordPress 6.0.2
  • Dynamic module assets loader — Support loading scripts and styles on demand, such as when page builders fetch and insert dynamic HTML
    • Implemented: Embed, Glider, Mermaid, Prism, Slider
    • In progress: Chart, Paginator, Table
  • Gutenberg, Beaver, and Elementor integrations
    • Ensure current post as default loop context in page builder preview, saved templates, builder-specific loops, and template shortcode
    • Remove unused styles
  • HTML module: Add special tag attribute named «tag-attributes» for dynamic attributes with or without value
  • HTML Lint library
    • Fork and wrap in unique namespace to improve compatibility with Customizer and other plugins that may load a different version
    • Modify core/rules/tag-pair.ts to be case-sensitive for tag names
  • Import & Export
    • Clear any cached field values such as compiled CSS when overwriting an existing template
    • Export all template types with orderby=menu_order, to ensure that location rules are applied in the correct priority
    • Support templates with post status other than publish: draft, future, pending, private (skip auto-draft, inherit/revision, and trash)
  • If tag: user_role condition
    • Add alias «admin» for administrator
    • Support all common comparison operators
    • Support shortcut for includes: user_role=admin
  • Layout template type
    • Correctly apply rule for «Singular — All post types»
    • Improve support for block themes
    • Render page content before head to support Meta tag in block themes
  • List and Loop tag: Add attribute «items» to create a list from comma-separated values
  • Logic module: Improve rules
    • For subject «list», add support for all common comparisons
    • Convert subject to list as expected: any_is, any_is_not, all_is, all_is_not, any_starts_with, all_starts_with, any_ends_with, all_ends_with
    • Convert value to list: in, not_in
    • For starts_with and ends_with, if subject is list then check first/last item
  • Map tag: Add «type» attribute for Key tag to specify value type: number, boolean, string, map, list
  • Script and Style template type: Add location rule «Nowhere» to disable loading
  • Start Comment loop type
  • Start developer docs: architecture, plan, design system
  • Style template type: Load earlier at wp_head action priority 9, before default (10)
  • Template archive view
    • Correctly show location rules for imported templates
    • Support select and copy template ID
  • Template editor
    • Disable AJAX save until following issues are resolved
    • Form nonce expiring after one day
    • Reliably save the post slug
    • Show confirmation dialog on window unload only when necessary
    • Make editor full height of template
    • Remember and restore current tab in template edit screen