Skip to content

Instantly share code, notes, and snippets.

View wpmark's full-sized avatar

Mark Wilkinson wpmark

View GitHub Profile
@wpmark
wpmark / hd-user-categories.php
Created June 11, 2021 11:05
A WordPress plugin that adds categories to users. It allows you to assign categories to users which you could then use elsewhere in your site.
<?php
/*
Plugin Name: User Categories
Plugin URI: https://highrise.digital/
Description: Adds categories to users. It allows you to assign categories to users which you could then use elsewhere in your site.
Version: 1.0
License: GPL-2.0+
Author: Highrise Digital Ltd
Author URI: https://highrise.digital/
Text domain: hd-user-categories
@wpmark
wpmark / highrise-auto-updater.php
Created March 31, 2021 13:20
Allow WordPress to auto update eveything.
<?php
/*
Plugin Name: Highrise Digital Auto Updater
Plugin URI: https://highrise.digital/
Description: A plugin to set WordPress to auto update everything.
Version: 1.0
License: GPL-2.0+
Author: Highrise Digital
Author URI: https://highrise.digital/
Text domain: highrise-auto-updater
@wpmark
wpmark / wp-dev-env-body-class.php
Created October 15, 2020 12:13
Output a body class based on the WP development environment
<?php
/**
* Adds a body class for the environment.
*
* @param array $classes The current array of body classes.
* @return array The new array of body classes.
*/
function hd_env_body_class( $classes ) {
// if WP environment function exists.
@wpmark
wpmark / extensible-changes.php
Created October 6, 2020 13:35
HD Extensible Social Profiles Widget
<?php
/**
* Edit the social profiles available.
*
* @param array $profiles The current array of registered social profiles.
* @return array The modified array of registered social profiles.
*/
function hd_test_edit_social_profile( $profiles ) {
// if we have a linkedin profile.
@wpmark
wpmark / readme.txt
Created January 17, 2020 14:47
Altering the meta compare value of the WP Broadbean Search salary field.
This function will change the behaviour of the salary field in the WP Broadbean Search form. By default the salary search only searches for values greater than whatever the user enters.
The code above changes the behaviour of this to return jobs that have salary values greater than AND equal to the value entered.
Place this code either in your themes functions.php file, your own plugin, or a file in the mu-plugins folder inside the wp-content folder.
@wpmark
wpmark / wpbb-salary-field-edit.php
Created July 19, 2017 14:53
Edit Salary Field in WP Broadbean
<?php
/**
* Edits the salary currency field in WP Broadbean by first removing it and
* then re-adding it back in with an additional currency for USD in the select.
*
* @param arrray $fields The current array of fields.
* @return array The modified array if fields.
*/
function wpmark_edit_salary_currency_field( $fields ) {
@wpmark
wpmark / ffpw-markup-overide.php
Created December 16, 2015 10:12
Overriding the Markup with the Flexible Featured Post Widget
<?php
/**
* function wpmark_remove_ffpw_output_action()
*
* removes the flexibile featured post widgets output
*/
function wpmark_remove_ffpw_output_action() {
remove_action( 'ffpw_featured_post_output', 'ffpw_featured_post_output', 10, 3 );
}
add_action( 'init', 'wpmark_remove_ffpw_output_action' );
@wpmark
wpmark / wp-in-own-dir.php
Created November 26, 2015 19:47
wp-config.php change for WordPress in its Own Directory
<?php
/**
* Bootstrap WordPress
*/
if ( !defined( 'ABSPATH' ) )
define( 'ABSPATH', dirname( __FILE__ ) . '/cms/' );
?>
@wpmark
wpmark / wp-custom-content-folder.php
Created November 26, 2015 19:43
Custom Content Directory for WordPress
<?php
* Custom Content Directory
*/
define( 'WP_CONTENT_DIR', dirname( __FILE__ ) . '/content' );
define( 'WP_CONTENT_URL', 'http://' . $_SERVER[ 'HTTP_HOST' ] . '/content' );
?>
@wpmark
wpmark / wp-query-orderby-muliple-meta-keys.php
Created November 18, 2015 12:48
WP_Query Ordered By Multiple Meta Keys
<?php
/* build a new wp_query */
$classes = new WP_Query(
array(
'post_type' => 'wpmark_class_time', // post type to query
'posts_per_page' => -1, // get all the posts not limited
'meta_query' => array(
'relation' => 'AND',
'day' => array( // give the first meta key array an array key
'key' => '_wpmark_day',