1. Go to this page and download the library: Download pressmodo/wp-attributes 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/ */
pressmodo / wp-attributes example snippets
use Pressmodo\Attributes\AttributesInterface;
$sut = new AttributesInterface();
$sut->add( 'context', [
'class' => 'color-primary',
'id' => 'unique_id',
] );
// ' class="color-primary" id="unique_id"'
echo $sut->render( 'context' );
$sut->add( 'another_context', [
'class' => '', // This will be skipped because empty
'attr1' => null, // This will be skipped because null
'attr2' => false, // This will be skipped because false
'attr3' => 0, // This will be skipped because 0 is also false
'id' => 'unique_id',
] );
// ' id="unique_id"'
echo $sut->render( 'another_context' );
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.