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 | |
add_action( 'wp_login', 'record_current_datetime_at_login', 10, 2 ); | |
/** | |
* Record Time and Date at login as a readable string. | |
* Save in user meta. | |
* | |
* @param string $user_login login_name | |
* @param object $user WP_User object | |
* @return string Date, time, timezone, offset | |
*/ |
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
// Add skip-lazy class ( or any class ) to featured image of latest post | |
function skip_lazy_class_first_featured_image($attr) { | |
global $wp_query; | |
if ( !is_single() && 0 == $wp_query->current_post ) { | |
$attr['class'] .= ' skip-lazy'; | |
} | |
return $attr; | |
} | |
add_filter('wp_get_attachment_image_attributes', 'skip_lazy_class_first_featured_image' ); |
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
<script type="application/ld+json"> | |
{ | |
"@context" : "http://schema.org", | |
"@type" : "ProfilePage", | |
"mainEntity" : { | |
"@type" : "Person", | |
"name" : "Jane Doe", | |
"givenName" : "Jane", | |
"familyName" : "Doe", | |
"email" : "[email protected]", |
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 | |
function nelio_max_image_size( $file ) { | |
$size = $file['size']; | |
$size = $size / 1024; | |
$type = $file['type']; | |
$is_image = strpos( $type, 'image' ) !== false; | |
$limit = 250; | |
$limit_output = '250kb'; |
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 | |
/* | |
For a better understanding of ics requirements and time formats | |
please check https://gist.github.com/jakebellacera/635416 | |
*/ | |
// UTILS | |
// Check if string is a timestamp |
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 | |
/** SHOW RELATED POSTS BY TAG, TAG IS INDICATED BY CUSTOM PROPERTY keyword => tag **/ | |
/** check for custom property **/ | |
$key = 'keyword'; | |
$keyword = get_post_meta($post->ID, $key, true); | |
if ($keyword != '') { | |
/** set max number of posts **/ | |
$num_posts = '4'; | |
/** setup the query array **/ |
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
/* Display Current User Role *************************************************************************** */ | |
/* http://wordpress.org/support/topic/how-to-get-the-current-logged-in-users-role ********************** */ | |
/* !로그인 회원역할 표시 *********************************************************************************** */ | |
/* <?php echo get_current_user_role(); ?> in your template ******************************************** */ | |
function get_current_user_role() { | |
global $wp_roles; | |
$current_user = wp_get_current_user(); | |
$roles = $current_user->roles; | |
$role = array_shift($roles); | |
return isset($wp_roles->role_names[$role]) ? translate_user_role($wp_roles->role_names[$role] ) : false; |
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 | |
/* | |
Limiting posts per user. | |
Enable the Paid Memberships Pro plugin and then add this code to your functions.php or as a stand alone plugin. | |
Be sure to read through this code carefully. Update each function to suit your needs. | |
This code has not been tested. Feel free to post issues in the comments. | |
*/ | |
//increment post limit when checking out | |
function my_pmpro_after_checkout($user_id) | |
{ |
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 | |
/** | |
* This is free and unencumbered software released into the public domain. | |
* | |
* Anyone is free to copy, modify, publish, use, compile, sell, or | |
* distribute this software, either in source code form or as a compiled | |
* binary, for any purpose, commercial or non-commercial, and by any | |
* means. | |
* |