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
add_action( 'wpcf7_before_send_mail', 'my_activtrail_cf7_integration' ); | |
function my_activtrail_cf7_integration( $cf7 ) { | |
$form_id = $_POST['_wpcf7']; | |
if ($form_id == XXX || $form_id == YYY): | |
$first_name = $_POST['first_name']; // get form data | |
... | |
// Do Something; | |
endif; | |
} |
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
Dropzone.options.dropzoneWordpressForm = { | |
acceptedFiles: "image/*", // all image mime types | |
maxFiles: 5, // max allowed upload | |
uploadMultiple: false, | |
maxFilesize: 5, // 5 MB | |
//addRemoveLinks: true, | |
//dictRemoveFile: 'X (remove)', | |
init: function() { | |
this.on("sending", function(file, xhr, formData) { | |
formData.append("name", "value"); // Append all the additional input data of your form here! |
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
// Get all playlists in the channel | |
function bio_youtube_get_playlists() { | |
$lists = array(); | |
$key = 'Youtube-API-Key'; | |
$channel = 'Channel-ID'; | |
$url = "https://www.googleapis.com/youtube/v3/playlists?key=$key&channelId=$channel&part=snippet,id&order=date&maxResults=20"; | |
$data = file_get_contents($url); | |
if (!empty($data)) { | |
$data_struct = json_decode($data); | |
if (is_array($data_struct->items)) { |
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
add_action('wp_login','user_last_login', 0, 2); | |
function user_last_login($login, $user) { | |
$user = get_user_by('login',$login); | |
$now = time(); | |
update_usermeta( $user->ID, 'user_last_login', $now ); | |
} |
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
function get_videos_from_youtube_api($num) { | |
if ( false === ( $data = get_transient( 'grafa-youtube-result' ) ) ) { | |
$key = 'Youtube-Key'; | |
$channel = 'Channel-ID'; | |
// $url = "https://www.googleapis.com/youtube/v3/playlistItems?key=$key&playlistId=$channel&part=snippet,id&order=date&maxResults=20"; | |
$url = "https://www.googleapis.com/youtube/v3/search?key=$key&channelId=$channel&part=snippet,id&order=date&maxResults=20"; | |
$data = file_get_contents($url); | |
set_transient( 'grafa-youtube-result', $data, 4 * HOUR_IN_SECONDS ); |
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
function import_featured_image($image_url, $caption, $post_id) { | |
$upload_dir = wp_upload_dir(); | |
$image_data = file_get_contents($image_url); | |
$filename = basename($image_url); | |
if(wp_mkdir_p($upload_dir['path'])) | |
$file = $upload_dir['path'] . '/' . $filename; | |
else | |
$file = $upload_dir['basedir'] . '/' . $filename; | |
file_put_contents($file, $image_data); |
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
function get_user_image($user) { | |
$img = get_field('author_image', 'user_'.$user->id); | |
if (!empty($img)) { | |
$img = wp_get_attachment_image($img['ID'], 'user_avatar'); | |
} else { | |
$img = get_avatar( $user->ID, 130); | |
} | |
return $img; | |
} |
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
add_action( 'quick_edit_custom_box', 'display_custom_quickedit_featured', 10, 2 ); | |
function display_custom_quickedit_featured( $column_name, $post_type ) { | |
static $printNonce = TRUE; | |
if ( $printNonce ) { | |
$printNonce = FALSE; | |
wp_nonce_field( plugin_basename( __FILE__ ), 'post_edit_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
if ( ! function_exists( 'nok_area_type' ) ) { | |
// Register Custom Taxonomy | |
function nok_area_type() { | |
$labels = array( | |
'name' => _x( 'Area Types', 'Taxonomy General Name', 'nok' ), | |
'singular_name' => _x( 'Area Type', 'Taxonomy Singular Name', 'nok' ), | |
'menu_name' => __( 'Area Type', 'nok' ), | |
'all_items' => __( 'All Items', 'nok' ), |
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
function nok_add_attarctions_cpt() { | |
$labels = array( | |
'name' => _x( 'Attractions', 'Post Type General Name', 'nok' ), | |
'singular_name' => _x( 'Attraction', 'Post Type Singular Name', 'nok' ), | |
'menu_name' => __( 'Attractions', 'nok' ), | |
'name_admin_bar' => __( 'Attraction', 'nok' ), | |
'archives' => __( 'Item Archives', 'nok' ), | |
'parent_item_colon' => __( 'Parent Item:', 'nok' ), | |
'all_items' => __( 'All Items', 'nok' ), |
NewerOlder