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 | |
/** | |
* Automatically login a single WordPress user upon arrival to a specific page. | |
* | |
* Redirect to home page once logged in and prevent viewing of the login page. | |
* Compatible with WordPress 3.9.1+ | |
* Updated 2014-07-18 to resolve WP_DEBUG notice: "get_userdatabylogin is deprecated since version 3.3! Use get_user_by('login') instead." | |
* Updated 2019-07-09 to reformat code, pass 2nd parameter to `do_action()`, and hook into priority 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
<?php | |
Copied from http://fatlabmusic.com/blog/2009/08/12/how-to-fix-wp-http-error-name-lookup-timed-out/ | |
//adjustments to wp-includes/http.php timeout values to workaround slow server responses | |
add_filter('http_request_args', 'bal_http_request_args', 100, 1); | |
function bal_http_request_args($r) //called on line 237 | |
{ | |
$r['timeout'] = 15; | |
return $r; | |
} | |
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 this code to your PMPro Customizations Plugin - http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* This function below sends a custom HTML email to the user that checks out for a pmpro membership level, easily extendible to send to admins, or specific users and so on. | |
* Website: https://paidmembershipspro.com | |
*/ | |
//let's send a custom email after user checkouts. This will not send an email if an admin changes user's level inside member area. | |
function custom_email_after_checkout( $user_id, $morder ){ |
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
/** | |
* Defer iframe loading. | |
* | |
* Markup: | |
* <div class="defer-iframe" data-src="{SOURCE URL}" data-{ATTR}="{VAL}"></div> | |
*/ | |
$(window).load( function(){ | |
if ($('.defer-iframe').length) { | |
$('.defer-iframe').each( function() { | |
var $iframe = $('<iframe frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>'); |
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 | |
/* vars for export */ | |
// database record to be exported | |
$db_record = 'XXXXXXXXX'; | |
// optional where query | |
$where = 'WHERE 1 ORDER BY 1'; | |
// filename for export | |
$csv_filename = 'db_export_'.$db_record.'_'.date('Y-m-d').'.csv'; | |
// database variables |
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
// The Loop | |
/* | |
* Usage: loop category="news" query="" pagination="false" | |
*/ | |
<?php | |
add_shortcode("loop", "myLoop"); | |
function myLoop($atts, $content = null) { | |
extract(shortcode_atts(array( |
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
//* Showing Full content and Featured image in 'testimonial' CPT archive page regardless of theme settings in Genesis | |
add_action( 'genesis_before_loop', 'sk_full_content_testimonials_archive' ); | |
function sk_full_content_testimonials_archive() { | |
if ( is_post_type_archive( 'testimonial' ) ) { | |
add_filter( 'genesis_pre_get_option_content_archive_thumbnail', 'sk_show_post_image' ); | |
add_filter( 'genesis_pre_get_option_content_archive', 'sk_do_full_content' ); | |
add_filter( 'genesis_pre_get_option_content_archive_limit', 'sk_no_content_limit' ); | |
} |
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
// Remove site description | |
add_filter( 'genesis_attr_site-description', 'abte_add_site_description_class' ); | |
/** | |
* Add class for screen readers to site description. | |
* | |
* Unhook this if you'd like to show the site description. | |
* | |
* @since 1.0.0 | |
* | |
* @param array $attributes Existing HTML attributes for site description element. |