PHP code example of se7enxweb / explayouts-tags-query

1. Go to this page and download the library: Download se7enxweb/explayouts-tags-query library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

se7enxweb / explayouts-tags-query example snippets



$query = new expLayoutsTagsQuery();
$items = $query->execute( array(
    'tags' => array( 'news', 'featured' ),
    'parent_id' => 2,
    'tags_filter_logic' => 'any',
    'limit' => 10,
) );

foreach ( $items as $item )
{
    echo $item->name . "\n"; // expLayoutsContentBrowserItem public property
}


$items = $query->execute( array(
    'use_tags_from_current_content' => true,
    'field_definition_identifier' => 'tags',
    'content_id' => $object->attribute( 'id' ),
    'tags_filter_logic' => 'any',
    'only_main_locations' => true,
    'limit' => 5,
) );