Function smart action runs a predefined code snippet or custom code and applies the value to the element.
Multiple functions can be run on the same element. Use “Add function” button to add an additional function.
At the moment, there is only one predefined code snippet that displays the current year.
That’s useful for displaying a copyright notice that always stays up to date.
For example, we can wrap the year in <span> element and then add Function – Current year on the <span>. We can use “Replace element” to replace the whole <span> with the current year:
Generated PHP code:
<p class="copyright"> <?php _e( '© Pine Adventures', 'simple' ); ?> <?php echo date( 'Y' ); ?> </p>
Adding custom PHP code
Anything else can be added as custom code.
Using the code
Use “Set” field to choose how to use the code:
Content will replace the content of the element with the code.
Replace element will replace the whole element with the code.
Insert before and insert after will insert the code before or after the element.
Image will set the src attribute.
Background image will use the code as the inline background-image style.
Link will set the href of the element.
Style will set the chosen style property.
Attribute will apply the code to the element attribute.