Add to page template
<div id="post-container">
/* Post titles will be inserted here */
</div>
<button id="load-more">Load More</button>
@media screen and (max-width: 600px) { | |
table { | |
width: 100%; | |
border-collapse: collapse; | |
} | |
tr:nth-child(even) { | |
background-color: #f0f0f0; | |
} |
<?php date_default_timezone_set('Australia/Perth'); ?> |
/* | |
Change the date of post ID 946 to the current date. | |
This is so the post is shown as the latest, thereby showing as the | |
latest post on the homepage and also as the latest post on the latest-news page. | |
*/ | |
function update_post_date_daily() { | |
$post = get_post(946); | |
if (version_compare(PHP_VERSION, '6.0.0') >= 0) { | |
echo 'I am at least PHP version 6.0.0, my version: ' . PHP_VERSION . "\n"; | |
} | |
if (version_compare(PHP_VERSION, '5.3.0') >= 0) { | |
echo 'I am at least PHP version 5.3.0, my version: ' . PHP_VERSION . "\n"; | |
} | |
if (version_compare(PHP_VERSION, '5.0.0', '>=')) { | |
echo 'I am using PHP 5, my version: ' . PHP_VERSION . "\n"; |
$(window).scroll(function() { | |
var top_of_element = $("#my_element").offset().top; | |
var bottom_of_element = $("#my_element").offset().top + $("#my_element").outerHeight(); | |
var bottom_of_screen = $(window).scrollTop() + $(window).innerHeight(); | |
var top_of_screen = $(window).scrollTop(); | |
if ((bottom_of_screen > top_of_element) && (top_of_screen < bottom_of_element)){ | |
// element is in view, do something | |
} else { | |
// element is out of view, do something else |
<?php /* | |
Board of Directors. | |
Template usage: <?php echo do_shortcode('[board_of_directors]'); ?> | |
Editor usage: Add a shortcode: [board_of_directors] | |
*/ | |
function board_of_directors_code() { | |
if( have_rows('directors', 19) ) { | |
while( have_rows('directors', 19) ) : the_row(); |
<?php | |
$current_version = '1.4.0'; | |
$required_version = '3.9.2'; | |
if (version_compare($current_version, $required_version) < 0) { | |
// Do something | |
} | |
?> |
Use this to validate credit card numbers. Dashes are ignored, so users may input them if they like. Tests for Visa, Mastercard, Amex, Discover, JCB, and Diners Club. Uses two hidden fields to store the type of card entered and whether or not the number entered is a valid credit card number. Regex source: http://stackoverflow.com/questions/72768/how-do-you-detect-credit-card-type-based-on-number
A Pen by Jon Crowell on CodePen.
if( $('.finished-auctions').is(':checked') ) { | |
// Do something | |
} |