### Full Pagination Example
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/02 - loop/11 - features/pagination.md
Combines Loop, PaginateButtons, and PaginateFields tags to create a complete AJAX-enabled pagination setup for a post loop.
```html
Page of
```
--------------------------------
### Year Calendar Example
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/02 - loop/05 - calendar.md
An example demonstrating looping through years and then through the months within each year.
```html
..
```
--------------------------------
### Clone Repository and Install Dependencies
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/reference/01 - template-system/index.md
Use these commands to clone the template system repository and install the necessary Node.js dependencies.
```sh
git clone https://github.com/tangibleinc/template-system
cd template-system
npm install
```
--------------------------------
### Start Local Development Server
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/reference/30 - documentation/index.md
Run this command to start a local development server for the documentation site. Changes are reflected live without needing to restart.
```bash
npm run start
```
--------------------------------
### Start Local Development Server
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/reference/02 - framework/design/index.md
Start a local development server using npm run serve. This command also initiates the development build script.
```sh
npm run serve
```
--------------------------------
### Full Example: Weekend Seminar Logic
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/11 - logic.md
This example demonstrates defining a logic rule for weekend seminars and then using it within a Loop to conditionally display seminar titles.
```html
Weekend seminar:
Weekday seminar:
```
--------------------------------
### Clone Repository and Install Dependencies
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/reference/02 - framework/design/index.md
Clone the design module's Git repository and install its necessary npm dependencies.
```sh
git clone git@github.com:tangibleinc/design tangible-design
cd tangible-design
npm install
```
--------------------------------
### Get a Site Setting
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/21 - setting.md
Use the Setting tag to retrieve a specific site setting by its name. For example, to get the administrator's email address.
```html
```
--------------------------------
### Install All Third-Party Plugins
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/reference/01 - template-system/index.md
Installs all required third-party plugins, such as ACF, Beaver Builder, and Elementor, into the `vendor/tangible` directory. Existing plugins are skipped by default.
```sh
npm run deps all
```
--------------------------------
### Equality Rule Example
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/reference/01 - template-system/logic/index.md
An example of a simple equality rule.
```javascript
{
'==': [1, 2]
}
```
--------------------------------
### Select Control Example
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/tangible-blocks/03 - legacy-controls/index.md
Example of a select control with predefined options. The 'options' attribute is required and maps keys to display labels.
```html
```
--------------------------------
### Basic Timer Usage
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/26 - timer.md
Demonstrates starting, checking, and stopping a timer to measure template rendering duration.
```html
...
Duration: seconds
...
Duration: seconds
```
--------------------------------
### Text Control Example
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/tangible-blocks/03 - legacy-controls/index.md
Basic example of a text input control with a default value. Text values in scripts will be outputted with quotes.
```html
```
--------------------------------
### Loop Through Weekdays Starting Sunday
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/02 - loop/05 - calendar.md
Optionally set `start=sunday` to start the week on Sunday when looping through weekdays.
```html
```
--------------------------------
### Basic Embed Example
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/04 - embed.md
Embeds HTML content from a given URL using the oEmbed protocol. Ensure the URL is from a supported oEmbed provider.
```html
```
--------------------------------
### Get Plugins Folder URL
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/27 - url.md
Use the 'plugins' attribute to get the URL of the plugins folder.
```html
```
--------------------------------
### Chained List Formatting Example
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/07 - format.md
Demonstrates chaining multiple Format tags to process a list: splitting a string, cleaning items, converting to lowercase, adding a prefix, and finally joining them with a delimiter. This complex example shows the power of nested Format tags.
```html
#Red*, !Green), @Blue(
```
--------------------------------
### Switch Control Example
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/tangible-blocks/03 - legacy-controls/index.md
Example of a switch control with custom values and labels for its on and off states. Note that in Beaver Builder, this renders as a select.
```html
on
On
off
Off
```
--------------------------------
### Select2 Control Example
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/tangible-blocks/03 - legacy-controls/index.md
Example of a Select2 control, which supports multiple selections and custom options. The 'multiple' and 'options' attributes are optional.
```html
```
--------------------------------
### Compound Rule Example
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/reference/01 - template-system/logic/index.md
An example of a compound rule using 'and' with nested comparison rules.
```javascript
{
and: [
{ '>': [1, 2] },
{ '<': [3, 4] }
]
}
```
--------------------------------
### Map Example in JavaScript Notation
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/12 - map.md
Illustrates the structure of the previously defined Map tag in JavaScript object notation.
```js
{
one: 'One',
two: 'Two'
}
```
--------------------------------
### Get WooCommerce Setting using Shortcut
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/integrations/woocommerce/Settings.mdx
A shorthand method to access any WooCommerce setting by its name. This is an alternative to the full `` or `` syntax.
```html
```
--------------------------------
### Install Playwright Browser Engines
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/reference/01 - template-system/index.md
Installs the necessary browser engines required by Playwright for running tests. This is typically run once before the first test execution.
```sh
npx playwright install
```
--------------------------------
### Gradient Control Example
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/tangible-blocks/03 - legacy-controls/index.md
The Gradient control allows users to define gradient colors and styles.
```html
```
--------------------------------
### Rendering Gradient Control in Templates
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/tangible-blocks/02 - block-controls/gradient.md
Demonstrates how to retrieve and loop through gradient control values in Tangible Blocks templates using Get and Loop.
```html
- Value:
- Type:
- Angle:
- Shape:
- Color:
```
--------------------------------
### Applying the Async Tag
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/29 - modules/async.md
This snippet demonstrates how to wrap an existing template, such as the Loop example, with the Async tag to enable lazy loading.
```html
...
```
--------------------------------
### Basic Loop Example
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/29 - modules/async.md
This snippet shows a typical Loop tag used to display a large number of posts. It is intended to be wrapped by the Async tag.
```html
```
--------------------------------
### Get and Set Math Variables
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/29 - modules/math.md
Illustrates using Get and Set tags with the 'math' attribute to interact with variables managed by the Math tag. This provides an alternative method for variable management.
```html
0
```
--------------------------------
### Get Plugins Folder Path
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/15 - path.md
This snippet demonstrates how to use the Path tag to retrieve the path to the plugins folder.
```html
```
--------------------------------
### Get Current Loop Count
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/02 - loop/11 - features/variables.md
Use the Get tag with the 'loop' attribute to retrieve the current loop count, which starts from 1.
```html
```
--------------------------------
### Get WooCommerce Review Settings
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/integrations/woocommerce/Settings.mdx
Retrieves various settings related to product reviews, including enablement and verification labels.
```html
```
```html
```
```html
```
```html
```
```html
```
--------------------------------
### Run End-to-End Tests
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/reference/01 - template-system/index.md
Execute the standard end-to-end test suite. The first run may prompt for browser engine installation.
```sh
npm run e2e
```
--------------------------------
### Get Field from Specific Post Type
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/06 - field.md
Use the 'type' and 'name' attributes with the Field tag to retrieve a field from a specific post or page. This example fetches the 'title' field from a page named 'example'.
```html
```
--------------------------------
### Run Documentation Generation
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/reference/30 - documentation/10 - generate.md
Execute the primary NPM script to generate documentation pages.
```sh
npm run gen
```
--------------------------------
### Get Character at Index
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/07 - format.md
Retrieves the character at index 1 from the string 'ABC'. Indexing starts at 0.
```html
ABC == B
```
--------------------------------
### Get List Item at Index
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/07 - format.md
Retrieves the item at index 1 from the list '[1,2,3]'. Indexing starts at 0.
```html
[1,2,3] == 2
```
--------------------------------
### Color Control Example
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/tangible-blocks/03 - legacy-controls/index.md
The Color control allows users to select colors. It supports RGBA and Hex formats and can optionally enable opacity.
```html
```
--------------------------------
### Gallery Control Example
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/tangible-blocks/03 - legacy-controls/index.md
Use the Gallery control to manage image attachments. The 'size' attribute controls the display size of the images.
```html
```
--------------------------------
### Get Specific Route Part by Index
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/19 - route.md
Extracts a single part of the URL route by its position, starting from 1 for the first part.
```html
```
--------------------------------
### Use a Template Variable
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/20 - set-get.md
Render a previously stored template variable. This example shows using a template variable within a loop.
```html
```
--------------------------------
### Basic Sass Styling
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/29 - modules/sass.md
Demonstrates how to use the Sass module to apply basic styling with variables.
```scss
```
--------------------------------
### Get Route Parts From Second to Last
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/19 - route.md
Retrieves all route parts starting from the second to last part to the end. Use '~' after the negative index.
```html
```
--------------------------------
### Align Control Example
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/tangible-blocks/03 - legacy-controls/index.md
Use the Align control for text alignment. It accepts 'right', 'center', or 'left' as default values.
```html
```
--------------------------------
### Get Route Parts Between Two Indexes
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/19 - route.md
Extracts a range of route parts, including the start and end indexes. Use '~' between the two indexes.
```html
```
--------------------------------
### Date Control Example
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/tangible-blocks/03 - legacy-controls/index.md
Use the Date control for date and time input. The format attribute allows customization of the date display.
```html
```
--------------------------------
### Rendering Select Control Value in Template
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/tangible-blocks/02 - block-controls/select.md
Examples of how to retrieve and display the value of a select control within a template using 'Get' for a single value or 'Loop' for multiple selected values.
```html
```
```html
```
--------------------------------
### Render Switch Value in Template
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/tangible-blocks/02 - block-controls/switch.md
Demonstrates how to retrieve and display the value of a switch control within an HTML template using Get or Loop.
```html
```
```html
```
--------------------------------
### Get a Field from a Setting Array
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/21 - setting.md
When a setting's value is an array or associative array, use the `field` attribute to access a specific property within that array. This example retrieves the 'id' field from a custom setting.
```html
```
--------------------------------
### Deploy Website (HTTPS)
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/readme.md
Deploy the built website using HTTPS. Replace with your actual GitHub username.
```bash
$ GIT_USER= npm run deploy
```
--------------------------------
### Get Total Items in ACF Repeater Field
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/02 - loop/11 - features/variables.md
Use the Get tag with 'loop=total' and 'acf_repeater' attributes to specify the repeater field name and get the total number of items within it.
```html
```
--------------------------------
### Deploy Documentation (SSH)
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/reference/30 - documentation/index.md
Deploy the documentation site using SSH. This command builds the website and pushes it to the 'gh-pages' branch, suitable for GitHub Pages hosting.
```bash
USE_SSH=true npm run deploy
```
--------------------------------
### Basic Glider Gallery Setup
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/29 - modules/glider.md
Use this snippet to create a basic full-screen gallery slider. Ensure thumbnail images are linked to their corresponding full-size image URLs.
```html
```
--------------------------------
### Get WooCommerce Product Placeholder Image
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/integrations/woocommerce/Settings.mdx
Retrieves the placeholder image setting for products. Supports custom height and width attributes.
```html
```
--------------------------------
### Date Manipulation with Tangible
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/reference/02 - framework/date/index.md
Demonstrates basic date object creation, setting locale, formatting, relative time, date attribute modification, and date arithmetic.
```php
$tdate = tangible\date();
$tdate->setLocale('fr');
$date = $tdate('3 days ago');
echo $date->ago(); // => il y a 3 jours
echo $date->format('l j F Y'); // => mardi 7 avril 2020
$date = $tdate('2000-01-31');
$date = $tdate->create(2000, 1, 31);
$date = $tdate->create(2000, 1, 31, 12, 0, 0);
$yesterday = $tdate->now()->sub('1 day');
$tomorrow = $tdate->now()->add('1 day');
echo $tdate->now()->timespan(
$tdate('+1000 days')
);
// 2 years, 8 months, 3 weeks, 5 days
$date->year = 2013;
$date->month = 1;
$date->day = 31;
$date->hour = 12;
$date->minute = 0;
$date->second = 0;
```
--------------------------------
### Get a Variable
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/20 - set-get.md
Use the Get tag with a variable name to retrieve its stored value.
```html
```
--------------------------------
### Clone the Documentation Repository
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/reference/30 - documentation/index.md
Clone the Loops and Logic documentation repository from GitHub. Use the HTTPS URL for public access or the SSH URL if you have direct access.
```bash
git clone https://github.com/tangibleinc/loops-and-logic-docs
cd loops-and-logic-docs
npm install
```
--------------------------------
### Build for Production
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/reference/02 - framework/design/index.md
Builds and minifies project files for production deployment.
```sh
npm run build
```
--------------------------------
### Display Posts Published in the Last Two Weeks
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/02 - loop/02 - post.mdx
This example shows posts published after a specific date, using '2 weeks ago' as the reference.
```html
```
--------------------------------
### Evaluate Basic Rule in PHP
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/reference/01 - template-system/logic/index.md
Demonstrates how to evaluate a simple equality rule using the Tangible Logic library in PHP.
```php
use tangible\logic;
logic\evaluate([
'==': [1, 1]
]); // === true
```
--------------------------------
### Get Network Admin URL
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/27 - url.md
Use the 'network_admin' attribute to get the network admin URL in a multisite environment.
```html
```
--------------------------------
### Deploy Website (SSH)
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/readme.md
Deploy the built website using SSH. Ensure you have SSH access configured for your Git repository.
```bash
$ USE_SSH=true npm run deploy
```
--------------------------------
### Get Network Home URL
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/27 - url.md
Use the 'network_home' attribute to get the network home URL in a multisite environment.
```html
```
--------------------------------
### Deploy Documentation (No SSH)
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/reference/30 - documentation/index.md
Deploy the documentation site without using SSH. Replace '' with your actual GitHub username. This command builds and pushes to 'gh-pages'.
```bash
GIT_USER= npm run deploy
```
--------------------------------
### Rendering Field Group Values with Loop
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/tangible-blocks/02 - block-controls/field-group.md
This example demonstrates how to iterate over the values of controls within a field group using the Loop construct in your template.
```html
```
--------------------------------
### Build Modules for Production
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/reference/01 - template-system/index.md
Builds minified bundles with source maps for specified modules, preparing them for production deployment.
```sh
npm run build [module1 module2..]
```
--------------------------------
### Run All Tests
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/reference/01 - template-system/index.md
Executes the full suite of unit and integration tests for the template system. This uses `wp-now` and does not require local installations of Docker or PHP.
```sh
npm run test
```
--------------------------------
### List Project Modules
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/reference/01 - template-system/index.md
Lists all modules within the project by finding `tangible.config.js` files. This command helps identify modules that can be built individually.
```sh
npm run list-modules
```
--------------------------------
### Render Number Control Value in Template (Get)
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/tangible-blocks/02 - block-controls/number.md
Use the 'Get' tag to directly render the value of a number control in your templates.
```html
```
--------------------------------
### Render Dimensions Control in Template (Get)
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/tangible-blocks/02 - block-controls/dimensions.md
Use the Get tag to render the raw value of the dimensions control in an HTML template.
```html
```
--------------------------------
### Build for Development
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/reference/02 - framework/design/index.md
Builds the project files and watches for changes to automatically rebuild. Use this if running a local server other than wp-now.
```sh
npm run dev
```
--------------------------------
### Get Network Site Root URL
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/27 - url.md
Use the 'network_site' attribute to get the network site root URL in a multisite environment.
```html
```
--------------------------------
### Get Logout URL
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/27 - url.md
Use the 'logout' attribute to get the logout URL. The redirect URL can be set using the 'redirect' parameter.
```html
```
--------------------------------
### Load a file from a specific path using 'from' and 'file'
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/11 - load.md
Use the `from` attribute to specify a path variable and the `file` attribute to provide the path to the file within that variable. File paths typically use forward slashes and should be quoted.
```html
```
--------------------------------
### Get Login URL
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/27 - url.md
Use the 'login' attribute to get the login URL. The redirect URL can be set using the 'redirect' parameter.
```html
```
--------------------------------
### Equivalent If/Else If/Else Structure
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/08 - if/switch-when.md
Shows the equivalent logic of the Switch and When example using standard If, Else if, and Else tags. This illustrates the underlying conditional structure.
```html
Value is 1.
Value is 2.
Value is something else.
```
--------------------------------
### Get Total Items in Loop
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/02 - loop/11 - features/variables.md
Use the Get tag with the 'loop' attribute to retrieve the total number of items in the current loop.
```html
```
--------------------------------
### Equivalent Taxonomy Term Loop using Loop and Field Tags
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/24 - taxonomy-term.md
This example demonstrates an alternative method using the Loop and Field tags to achieve the same result as the Taxonomy tag. It explicitly defines the taxonomy, post, and field to be accessed.
```html
```
--------------------------------
### Get Previous Loop Total
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/02 - loop/11 - features/variables.md
Use the Get tag with the 'loop' attribute to retrieve the total number of items from the previous loop after it has closed.
```html
```
--------------------------------
### Rendering Date Picker Value in Template (Get)
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/tangible-blocks/02 - block-controls/date.md
Use the `Get` tag to retrieve and display the value of a date picker control within a template.
```html
```
--------------------------------
### Basic Switch and When Structure
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/08 - if/switch-when.md
Demonstrates the fundamental structure of Switch and When tags for conditional rendering based on a field's value. An empty When tag acts as a default case.
```html
Value is 1.
Value is 2.
Value is something else.
```
--------------------------------
### Get User Registration URL
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/27 - url.md
Use the 'register' attribute to get the user registration URL. The redirect URL can be set using the 'redirect' parameter.
```html
```
--------------------------------
### Load a file using the 'file' attribute
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/11 - load.md
Use the `file` attribute to specify the path to the file you want to load. Ensure the file path is quoted.
```html
```
--------------------------------
### Load Tangible Logic Module in PHP
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/reference/01 - template-system/logic/index.md
Includes the Tangible Logic module in a PHP project, ensuring the newest version is loaded.
```php
require_once __DIR__ . '/vendor/tangible/logic/module.php';
```
--------------------------------
### Slider with Responsive Options via List
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/29 - modules/slider.md
Demonstrates how to configure responsive item display for a Slider by defining options in a separate List and passing it to the 'responsive' attribute. This example sets 4 items by default, 3 items for widths below 800px, and 2 items for widths below 480px.
```html
..
```
--------------------------------
### Applying Gradient Control in Styles (SCSS)
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/tangible-blocks/02 - block-controls/gradient.md
Shows how to use a gradient control's value as a background image in SCSS styles.
```scss
.style {
background-image: $gradient_name;
}
```
--------------------------------
### Getting a Logic Variable
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/08 - if/02 - logic-variables.md
Use the `Get` tag with the `logic` attribute to retrieve the evaluated state of a logic variable. It returns `true` if the condition is met, and an empty value if it is false.
```html
```
--------------------------------
### Format List with Prefix and Join
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/07 - format.md
Applies a prefix to each item in a list and then joins them with a space. Useful for styling list items.
```html
["red","green","blue"]
```
--------------------------------
### Gravity Forms Poll Field Example
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/integrations/gravity-forms/Form Entry Fields.mdx
Example demonstrating how to display poll field data, including results, using Loops & Logic conditional and loop tags. Requires the field type to be 'poll'.
```html
* Text:/
* Value:/
** Results:
-Label:
-Total Entries:
-Percentage:
```
--------------------------------
### User Tag Equivalent to User Loop
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/28 - user.md
Demonstrates the equivalence between the User tag and the User loop for accessing user fields.
```html
```
--------------------------------
### Apply Case Formatting to List Items
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/07 - format.md
Converts each string in the list '["Hello","World"]' to lowercase. This demonstrates applying a format to each item within a list.
```html
["Hello","World"]
```
--------------------------------
### Set and Get Local Variables
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/20 - set-get.md
Use the 'local' attribute with Set and Get tags to manage local variables. Local variables are confined to the current template and its children, preventing conflicts with outer scope variables.
```html
..
```
--------------------------------
### Get Asset URL from Template
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/getting-started/loops-and-logic/08 - template-assets.md
Use the Get tag with the 'asset' attribute to retrieve specific fields like the URL from a template asset. The 'asset' attribute specifies the asset name, and the optional 'field' attribute determines which data to fetch.
```html
```
--------------------------------
### Composer Configuration for Tangible Logic
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/reference/01 - template-system/logic/index.md
Configuration for `composer.json` to include the Tangible Logic library from a Git repository.
```json
{
"repositories": [
{
"type": "vcs",
"url": "git@github.com:tangibleinc/logic"
}
],
"require": {
"tangible/logic": "dev-main"
},
"minimum-stability": "dev"
}
```
--------------------------------
### Get WooCommerce Measurement Units
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/integrations/woocommerce/Settings.mdx
Retrieves the configured units for weight and dimensions in WooCommerce.
```html
```
```html
```
--------------------------------
### Using the Note Tag
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/14 - note.md
Demonstrates the basic usage of the Note tag. Content within the Note tag is ignored during rendering and does not appear in the DOM.
```html
Here is a note.
```
--------------------------------
### Get WooCommerce Currency Settings
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/integrations/woocommerce/Settings.mdx
Retrieves various currency-related settings for the WooCommerce store.
```html
```
```html
```
```html
```
```html
```
```html
```
--------------------------------
### Render Template from File in PHP
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/25 - template.md
Use the `tangible_template()->load_file()` method in PHP to load and render a template from a specified file path. The `__DIR__` constant is useful for relative paths.
```php
echo tangible_template()->load_file( __DIR__ . '/example.html' );
```
--------------------------------
### Render Checkbox Value in Template
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/tangible-blocks/02 - block-controls/checkbox.md
Renders the checkbox value using Get or Loop in a template.
```html
```
```html
```
--------------------------------
### Example of a self-closed tag with an attribute
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/index.md
Demonstrates a self-closed dynamic tag with a 'name' attribute and a 'title' value.
```html
```
--------------------------------
### Get Site URL
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/22 - site.md
Use the Site tag with the 'url' field to retrieve the site's URL.
```html
```
--------------------------------
### Image Control Example
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/tangible-blocks/03 - legacy-controls/index.md
The Image control enables users to upload or select images. It can retrieve image details like title, alt text, and description.
```html
https://ps.w.org/tangible-loops-and-logic/assets/banner-1544x500.jpg
```
--------------------------------
### Rendering Text Control Value in Template
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/tangible-blocks/02 - block-controls/text.md
Renders the text control value in a template using Get or Loop.
```html
```
--------------------------------
### Convert Text to Kebab Case
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/07 - format.md
Converts the input string 'Hello, world' to kebab-case. This is useful for generating URL-friendly slugs or CSS class names.
```html
Hello, world
```
--------------------------------
### Get WooCommerce Store Address Settings
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/integrations/woocommerce/Settings.mdx
Retrieves various components of the store's address from WooCommerce settings.
```html
```
```html
```
```html
```
```html
```
--------------------------------
### Display Link Field URL
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/integrations/advanced-custom-fields.md
Use `acf_link` attribute with `field=url` to get the URL of an ACF link field.
```html
```
--------------------------------
### Display Image Field URL
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/integrations/advanced-custom-fields.md
Use `acf_image` attribute with `field=url` to get the URL of an ACF image field.
```html
```
--------------------------------
### Display File Field URL
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/integrations/advanced-custom-fields.md
Use `acf_file` attribute with `field=url` to get the URL of an ACF file field.
```html
```
--------------------------------
### Getting the Entire List
Source: https://github.com/tangibleinc/loops-and-logic-docs/blob/main/docs/dynamic-tags/10 - list.md
Retrieves the entire list associated with the name 'numbers' and outputs it as a JSON encoded string.
```html
```