Loops & Logic

Descripción

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.

Support

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

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

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

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

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

    <?php endwhile; ?>
  </ul>
<?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}" />

  </If>
</Loop>

✅ 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.
</If>

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.

Bloques

Este plugin proporciona 1 bloque.

  • Tangible Template

Instalación

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

Reseñas

22 de noviembre de 2022
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
8 de julio de 2022 2 respuestas
Good thing I already have some coding background and like to experiment or I wouldn't have figured out how to use this pretty awesome plugin. It's still less work than using PHP and dealing with endless incompatibilities and every possible security concern. Just write the code for the project needed. I'm very happy about this plugin enabling me to make a calendar that has no bloat and does what I want it to. If only the documentation was really complete I feel like this plugin could help me build any plugin I could ever want. This stuff could replace any plugin, any theme and also that darn block editor. I'm looking to forward to be using just WP and L&L someday without any extra installs.
12 de mayo de 2022
Custom content was good and powerful, but Loops&Logic brings it to another level! The plugin is very clean, and gives you the opportunity to do a crazy amount of dynamic coding, and is especially useful when you find that "almost perfect" plugin which lacks a feature or two : with L&L, you can most of the time add this feature yourself. True, it's not a drag and drop plugin, and you'll have to study the documentation and take some time to master it, but the investment is really worth it. I'm not doing much with L&L right now, only pretty simple dynamic stuff, but it's a relieve to know it's there, and as soon as there is something I wish to do that is not included in a plugin's feature, I'll always immediatly turn to L&L to see if it can be done. So far, I've never been disappointed 🙂 Last and not least, this is a free plugin, which is crazy considering all the possibilities it offers!
25 de abril de 2022 2 respuestas
Actived it and my site return 502 error for all links. Solved by deleting it.
Leer todas las 15 reseñas

Colaboradores y desarrolladores

«Loops & Logic» es un software de código abierto. Las siguientes personas han colaborado con este plugin.

Colaboradores

Traduce «Loops & Logic» a tu idioma.

¿Interesado en el desarrollo?

Revisa el código , echa un vistazo al repositorio SVN o suscríbete al registro de desarrollo por RSS.

Registro de cambios

3.0.1

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

3.0.0

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