mardi 27 janvier 2015

Change an option string to a function


I'm creating an options page for my theme where I can insert a code in a text field as a condition for displaying sidebars in my website.


Let's say I'm inserting this value in the text input:


Now I want to use this value as a condition to display the sidebar, something like that:



<?php $condition = $options['condition']; if ( $condition ) echo 'sidebar on'; } ?>


The problem is $condition in the if statement is considered a string not a function.


I want it a function of the value I inserted in the text field.





Aucun commentaire:

Enregistrer un commentaire