Instantly share code, notes, and snippets.

View functions.php
<?php
######################################################
//Here we will check to see if the special offer being presented
//is in the list of the dealers posts and if not do a 301 redirect
//back to the home page
//added on 19/10/2018 by craig@jucra.com
######################################################
function white_label_special_offer_301_redirect_check($array_of_dealer) {
###################################################
View functions.php
<?php
######################################################
//get a list of specials assigned to a dealer so that we can display a list
//of post id's in the array_of_dealer
//added on 19/10/2018 by craig@jucra.com
######################################################
function white_label_get_array_of_special_offer_posts_for_dealer($dealer_id) {
###################################################
//STEP 1
View jucra-affiliates-to-clients-matching.php
<?php
/*
Custom WHMCS Affiliate hook by craig@jucra.com
Date: 14th October 2018
Stored in WHCMS: /includes/hooks/
The WHMCS affiliate system is basic, very basic in terms of: affiliates can only
earn comissions based on orders they generate.
View get-files-and-folders-array.php
<?php
###########################
/*
This script is useful if you wanted to get a list of the files and folders within a directory on your web site.
EG: Lets say you wanted to monitor your theme folder in wordpress. With this script you can generate a list of
all the files and folders and check for any changes.
You could extend this script to exclude certain folders or file names or file types.
View block-one-or-more-countries-from-accessing-your-web-site.php
<?php
/*
Block one or more countries from accessing your web site
Written by craig@123marbella.com on 4th of October 2017
Wordpress users you can put this in the top of your functions.php file
to prevent visitors from certain countries.
*/
View display-directory-contents.php
<?php
/*
written by craig@123marbella.com on 19th Jan 2016
This script can be placed in a folder and will display the contents of the folder based on the file extensions you define in the settings below.
With this function you can:
- define a specific list of extensions to display on the page
- define a H1/title tag for the page
- define a custom logo
View create-email-password-for-rackspace-mail.php
<?php
/*
Create a complex 8 character password which meets (exceeds actually) the rackspace mail requirements.
Author: craig@123marbella.com ON 27/9/2017
This function allows you to specify the length of the password and the specific characters to include in the password.
Compleletly random passwords look ugly, so this function will build the password into a random and complex, yet friendlier looking password.
View block-one-or-more-countries-from-accessing-one-or-more-pages-on-your-web-site.php
<?php
############################
// Block one or more countries from accessing one or more pages on your web site
// Using Wordpress? Put this script into your functions.php
// Author: craig@123marbella.com
// Date: 21/9/2017
// See: https://gist.github.com/craigedmonds/2c6bea241e5e2bd29ca64eab5a2c5a57
############################
//define some urls you wish to block
View wordpress-redirect-user-based-on-country-and-page-id.php
<?php
############################
// Block a country from accessing a certain wordpress page
// Put this script into your functions.php
// Author: craig@123marbella.com
// Date: 21/9/2017
############################
//define some page id's that you want to block
$array_of_page_ids_to_block = array(
View wordpress-save-post-action-custom-post-type.php
<?php
/*
Sometimes you need to do some kind of action to a custom post type after its saved.
In the case of this function my scenario is:
1. I have a custom post type registered called: clients
2. I want the url of their details page to be: /client-number-999/ (where 999 is the post_id - or client id)
Created by craig@123marbella.com on 16th of August 2017