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 | |
| /** | |
| * BFI Thumb For Custom Image Src | |
| */ | |
| function code_custom_img( $image_src, $image_width, $image_height ) { | |
| $custom_image_src = bfi_thumb( $image_src, array( 'width' => $image_width, 'height' => $image_height) ); | |
| return $custom_image_src; | |
| } |
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_ajax_infinite_scroll_home', 'infinite_scroll_home', 0); | |
| add_action('wp_ajax_nopriv_infinite_scroll_home', 'infinite_scroll_home'); | |
| function infinite_scroll_home() { | |
| $exclude_posts_json = $_POST['exclude_posts']; | |
| $exclude_posts = json_decode($exclude_posts_json); | |
| $post_offset = $_POST['post_offset']; | |
| $infinite_scroll_args = array( 'post_type'=>'post', 'posts_per_page'=> 2,'post__not_in' => $exclude_posts, 'offset' => $post_offset); | |
| $infinite_scroll_query = new WP_Query( $infinite_scroll_args ); | |
| while( $infinite_scroll_query->have_posts() ) : $infinite_scroll_query->the_post(); |
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 | |
| require get_template_directory() . '/inc/mailchipapi.php'; | |
| add_action('wp_ajax_add_to_mailchimp_list', 'add_to_mailchimp_list', 0); | |
| add_action('wp_ajax_nopriv_add_to_mailchimp_list', 'add_to_mailchimp_list'); | |
| function add_to_mailchimp_list() { | |
| $apiKey = 'YOUR_API_KEY'; | |
| $listId = 'YOUR_LIST_ID'; // End Customer | |
| $double_optin=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 | |
| add_action('wp_ajax_facebook_share', 'facebook_share', 0); | |
| add_action('wp_ajax_nopriv_facebook_share', 'facebook_share'); | |
| function facebook_share() { | |
| $your_data = $_POST['your_data']; | |
| echo $your_data; | |
| die; | |
| } |
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_ajax_twitter_share', 'twitter_share', 0); | |
| add_action('wp_ajax_nopriv_twitter_share', 'twitter_share'); | |
| function twitter_share() { | |
| $your_data = $_POST['your_data']; | |
| echo $your_data; | |
| die; | |
| } |
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 | |
| /** | |
| * Post view Count | |
| */ | |
| remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0); | |
| function wpb_set_post_views($postID) { | |
| $count_key = 'wpb_post_views_count'; | |
| $count = get_post_meta($postID, $count_key, true); | |
| if($count==''){ | |
| $count = 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
| <?php | |
| remove_filter('authenticate', 'wp_authenticate_username_password', 20); | |
| add_filter('authenticate', 'login_with_email', 20, 3); | |
| function login_with_email($user, $email, $password) { | |
| //Check for empty fields | |
| if(filter_var($email, FILTER_VALIDATE_EMAIL) ){ | |
| if(empty($email) || empty ($password)){ | |
| //create new error object and add errors to it. | |
| $error = new WP_Error(); | |
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_failed', 'code_login_failed' ); | |
| function code_login_failed( $user ) { | |
| // check what page the login attempt is coming from | |
| $referrer = $_SERVER['HTTP_REFERER']; | |
| // check that were not on the default login page | |
| if ( !empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin') && $user!=null ) { | |
| // make sure we don't already have a failed login attempt |
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 | |
| /** | |
| * Return Path Change | |
| */ | |
| class email_return_path { | |
| function __construct() { | |
| add_action( 'phpmailer_init', array( $this, 'fix' ) ); | |
| } | |
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 my_login_redirect( $redirect_to, $request, $user ) { | |
| //is there a user to check? | |
| global $user; | |
| if ( isset( $user->roles ) && is_array( $user->roles ) ) { | |
| //check for admins | |
| if ( in_array( 'administrator', $user->roles ) ) { | |
| // redirect them to the default place | |
| return $redirect_to; | |
| } else { |