This file contains 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
//Limit pages nesting depth to 2nd level | |
//caution! by default affects all hierarchical CPTs | |
function limit_pages_nesting($a) { | |
$a['depth'] = 1; | |
return $a; | |
} | |
add_action('page_attributes_dropdown_pages_args','limit_pages_nesting'); |
This file contains 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
//does not work with colors containing alpha | |
@function encodecolor($string) { | |
@if type-of($string) == 'color' { | |
$hex: str-slice(ie-hex-str($string), 4); | |
$string:unquote("#{$hex}"); | |
} | |
$string: '%23' + $string; | |
@return $string; | |
} |
This file contains 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 | |
//Add metabox with dynamically added key-value (with more values possible) custom fields | |
//Based on http://wordpress.stackexchange.com/questions/19838/create-more-meta-boxes-as-needed/19852#19852 | |
// Caution, there're 2 set of options below | |
//Variables used in the following functions should be mentioned in the 'global' statement of each of them appropriately | |
//=======Options 1======= | |
$dmb_post_type = 'tribe_events'; | |
$dmb_metabox_label = 'Other information'; | |
$dmb_cf_name = 'tribe_events_miscinfo'; |
This file contains 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 | |
/* | |
Plugin Name: Duplicate Title Checker (zip all related files to upload it) | |
Plugin URI: http://wordpress.org/extend/plugins/duplicate-title-checker/ | |
Description: This plugin provides alert message for duplicate post title and unique post title when adding new post. | |
Author: Ketan Ajani, improved by fuchsws and certainlyakey (see http://wordpress.org/support/topic/suggestions-35?replies=2) | |
Version: 1.1 | |
Author URI: http://www.webconfines.com | |
*/ | |
This file contains 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
//Alternates reference point position with each activation from top left to bottom right | |
//Assign a keyboard shortcut for fast use | |
if (app.activeWindow.transformReferencePoint == AnchorPoint.BOTTOM_RIGHT_ANCHOR) { | |
app.activeWindow.transformReferencePoint = AnchorPoint.TOP_LEFT_ANCHOR; | |
} else if (app.activeWindow.transformReferencePoint == AnchorPoint.TOP_LEFT_ANCHOR) { | |
app.activeWindow.transformReferencePoint = AnchorPoint.TOP_CENTER_ANCHOR; | |
} else if (app.activeWindow.transformReferencePoint == AnchorPoint.TOP_CENTER_ANCHOR) { | |
app.activeWindow.transformReferencePoint = AnchorPoint.TOP_RIGHT_ANCHOR; | |
} else if (app.activeWindow.transformReferencePoint == AnchorPoint.TOP_RIGHT_ANCHOR) { | |
app.activeWindow.transformReferencePoint = AnchorPoint.LEFT_CENTER_ANCHOR; |
This file contains 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 | |
// First we register the Google Recaptcha script as a dependency with an onload callback | |
wp_register_script( 'recaptcha_v2', add_query_arg(['render' => 'explicit', 'onload' => 'onloadRecaptchaCallback'], 'https://www.google.com/recaptcha/api.js'), [], null, true); | |
wp_enqueue_script( 'recaptcha_v2' ); | |
// Here we validate Google Recaptcha token issued on our frontend with Google servers using our custom 'validate_captcha' WP AJAX hook | |
function hh_validate_captcha() { | |
check_ajax_referer( 'hhsubscribe', '_ajax_nonce' ); |
This file contains 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 | |
/* | |
Plugin Name: GF file upload to ACF image field | |
Plugin URI: https://gist.github.com/certainlyakey/8c19791b3133beb62d323bf060bf4270 | |
Description: Map Gravity forms file upload field to ACF image/file field so GF would upload the file and save id to DB instead of URL. | |
Version: 1.0.0 | |
Author: Kellen Mace | |
*/ | |
This file contains 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
//Sort title by article numbers - 'Article 23. ...' | |
function sort_titles_article_numbers($a,$b) { | |
$akey = $a->post_title; | |
if (preg_match('/^Article (\d+)\. /', $akey, $matches)) { | |
$akey = $matches[1]; | |
} | |
$bkey = $b->post_title; | |
if (preg_match('/^Article (\d+)\. /', $bkey, $matches)) { | |
$bkey = $matches[1]; | |
} |
This file contains 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
- var price = Math.floor(Math.random() * (15 - 1300) + 1300) |
This file contains 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
// Allow editors edit menus | |
$role_object = get_role( 'editor' ); | |
$role_object->add_cap( 'edit_theme_options' ); |
NewerOlder