Skip to content

Instantly share code, notes, and snippets.

@kevinvess
kevinvess / extend_upcoming_service_display.php
Last active November 19, 2020 21:42
UUA Services Widgets Filter – Extend the active upcoming service
<?php
/**
* Filter the UUA Services 'Upcoming Service' Query.
*
* Extend the time by two hours before switching to the next service.
*
* @param array $query_args An array of query arguments.
* @return array
*/
function extend_upcoming_service_display( $query_args ) {
@kevinvess
kevinvess / wordpress-replace-siteurl.sql
Last active June 22, 2018 13:20
This SQL statement will replace any instance of the site's current url with a new url in all the common locations of a WordPress database.
UPDATE wp_options SET option_value = replace(option_value, 'http://current-url.com', 'http://new-url.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://current-url.com', 'http://new-url.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://current-url.com', 'http://new-url.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://current-url.com', 'http://new-url.com');
@kevinvess
kevinvess / wp-force-login-bypass-facebook.php
Last active March 30, 2018 19:21
Sample code showing how to allow the Facebook Crawler to bypass the Force Login plugin
<?php
/**
* Bypass Force Login to allow for exceptions.
*
* @param bool $bypass True to disable Force Login. Default False.
* @return boolean
*/
function my_forcelogin_bypass( $bypass ) {
// Allow the Facebook Crawler to access the site
if ( strpos($_SERVER["HTTP_USER_AGENT"], "facebookexternalhit/") !== false || strpos($_SERVER["HTTP_USER_AGENT"], "Facebot") !== false ) {
@kevinvess
kevinvess / wp-force-login-buddypress.php
Created March 1, 2017 21:44
Sample code showing how to bypass the Force Login plugin for BuddyPress registration
<?php
/**
* Bypass Force Login to allow for exceptions.
*
* @return bool Whether to disable Force Login. Default false.
*/
function my_forcelogin_bypass( $bypass ) {
// add exception for buddypress login URLs
if ( function_exists('bp_is_register_page') ) {
if ( bp_is_register_page() || bp_is_activation_page() ) {
@kevinvess
kevinvess / bullet-color-example.html
Last active December 22, 2015 20:39
This javascript/jquery snippet will allow you to dynamically change the bullet color of all unordered lists in a given content block while keeping the original text color set by the CSS. This is particularly useful when dealing with a CMS that will output the content block and the design calls for the bullet color to be different than the text c…
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>list bullet color change demo</title>
<style>
body {
color: #666;
}
@kevinvess
kevinvess / wp-force-login-redirect.php
Created March 27, 2015 21:07
Sample code showing how to set a custom redirect in the Force Login plugin
<?php
/**
* Set the URL to redirect to on login.
*
* @return string URL to redirect to on login. Must be absolute.
**/
function my_forcelogin_redirect() {
return site_url( '/mypage/' );
}
add_filter('v_forcelogin_redirect', 'my_forcelogin_redirect', 10, 1);