This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Placeholder @mixin for Sass | |
// | |
// A mixin to style placeholders in HTML5 form elements. | |
// Includes also a .placeholder class to be used with a polyfill e.g. | |
// https://github.com/mathiasbynens/jquery-placeholder | |
// Requires Sass 3.2. | |
// | |
// Example usage (.scss): | |
// | |
// input { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Get the repeater field | |
$repeater = get_field( 'repeater_field_name' ); | |
// Get a random rows. Change the second parameter in array_rand() to how many rows you want. | |
$random_rows = array_rand( $repeater, 2 ); | |
// Loop through the random rows if more than one is returned | |
if( is_array( $random_rows ) ){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$last_modified = human_time_diff( the_modified_date('U','','', false), current_time('timestamp') ); | |
$number_of_x = preg_replace('/[^0-9]*/', '', $last_modified); | |
if ( strpos( $last_modified, 'min' ) || strpos( $last_modified, 'hour' ) || strpos($last_modified, 'sec' ) ) { | |
$wiki_date = $last_modified; | |
} elseif ( $number_of_x > 365 ) { | |
$wiki_date = __( 'a long time' ); | |
} elseif ( $number_of_x >= 180 ) { | |
$wiki_date = __( 'less than a year' ); | |
} elseif ( $number_of_x >= 60 ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BEGIN WordPress | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
..... | |
</IfModule> | |
# END WordPress | |
# this is not working any more | |
# 500 internal error is being returned | |
php_value upload_max_filesize 64M |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// _decimal.scss | MIT License | gist.github.com/terkel/4373420 | |
// Round a number to specified digits. | |
// | |
// @param {Number} $number A number to round | |
// @param {Number} [$digits:0] Digits to output | |
// @param {String} [$mode:round] (round|ceil|floor) How to round a number | |
// @return {Number} A rounded number | |
// @example | |
// decimal-round(0.333) => 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wp_get_mime_types() { | |
/** | |
* Filter the list of mime types and file extensions. | |
* | |
* This filter should be used to add, not remove, mime types. To remove | |
* mime types, use the 'upload_mimes' filter. | |
* | |
* @since 3.5.0 | |
* | |
* @param array $wp_get_mime_types Mime types keyed by the file extension regex |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Global variables | |
* | |
* The most used WordPress core functions | |
* in one global var for easier sitewide usage. | |
* | |
* @return array Returns array | |
*/ | |
function zzap_global_site() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Hook | |
*/ | |
add_filter( 'post_class' , 'zzap_cpt_post_class' ); | |
/** | |
* Custom post classes for custom post types based on taxonomies | |
* | |
* Default 'posts' in WordPress have, among other, classes | |
* based on their categories and tags. This function adds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Hook | |
*/ | |
add_filter( 'the_content', 'remove_inactive_shortcodes' ); | |
/** | |
* Remove inactive shortcodes | |
* | |
* Make sure inactive shortcodes don't leave their junk in the content. | |
* We are striping their tags, leaving content as is. This function is attached to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Custom meta | |
* | |
* Check if the field is populated and echo it | |
* or return its value, if any. | |
* | |
* @link https://developer.wordpress.org/reference/functions/get_post_meta/ | |
* | |
* @param string $custom_field Unique id for custom field |
OlderNewer