It's that simple:
$os = getOS($_SERVER['HTTP_USER_AGENT']);
echo $os;| // This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref | |
| <?php | |
| /** | |
| * WordPress Query Comprehensive Reference | |
| * Compiled by luetkemj - luetkemj.github.io | |
| * | |
| * CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters | |
| * Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php | |
| */ |
| // Goes in theme.liquid | |
| {% if template contains 'contact' %} | |
| {{ 'https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js' | script_tag }} | |
| <script type="text/javascript"> | |
| $(document).ready(function() { | |
| var n1 = Math.round(Math.random() * 10 + 1); | |
| var n2 = Math.round(Math.random() * 10 + 1); | |
| $("#question").val(n1 + " + " + n2); | |
| $(".contact-form").submit(function (e) { | |
| if (eval($("#question").val()) != $("#answer").val()) { |
| <?php | |
| // PHP memory limit for this site | |
| define( 'WP_MEMORY_LIMIT', '128M' ); | |
| define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit. | |
| // Database | |
| define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database. | |
| define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users) | |
| // Explicitely setting url |