Skip to content

Instantly share code, notes, and snippets.


Mark Wilkinson wpmark

View GitHub Profile
wpmark / wp-dev-env-body-class.php
Created Oct 15, 2020
Output a body class based on the WP development environment
View wp-dev-env-body-class.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 / extensible-changes.php
Created Oct 6, 2020
HD Extensible Social Profiles Widget
View extensible-changes.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 / readme.txt
Created Jan 17, 2020
Altering the meta compare value of the WP Broadbean Search salary field.
View readme.txt
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 / wpbb-salary-field-edit.php
Created Jul 19, 2017
Edit Salary Field in WP Broadbean
View wpbb-salary-field-edit.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 / ffpw-markup-overide.php
Created Dec 16, 2015
Overriding the Markup with the Flexible Featured Post Widget
View ffpw-markup-overide.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 / wp-in-own-dir.php
Created Nov 26, 2015
wp-config.php change for WordPress in its Own Directory
View wp-in-own-dir.php
* Bootstrap WordPress
if ( !defined( 'ABSPATH' ) )
define( 'ABSPATH', dirname( __FILE__ ) . '/cms/' );
wpmark / wp-custom-content-folder.php
Created Nov 26, 2015
Custom Content Directory for WordPress
View wp-custom-content-folder.php
* Custom Content Directory
define( 'WP_CONTENT_DIR', dirname( __FILE__ ) . '/content' );
define( 'WP_CONTENT_URL', 'http://' . $_SERVER[ 'HTTP_HOST' ] . '/content' );
wpmark / wp-query-orderby-muliple-meta-keys.php
Created Nov 18, 2015
WP_Query Ordered By Multiple Meta Keys
View wp-query-orderby-muliple-meta-keys.php
/* build a new wp_query */
$classes = new WP_Query(
'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',
wpmark / wp-ajax-search-functions-hooked.php
Last active Nov 16, 2019
AJAX Search Function for Post Titles
View wp-ajax-search-functions-hooked.php
function myplugin_ajax_job_search() {
/* get the search terms entered into the search box */
$search = sanitize_text_field( $_POST[ 'search' ] );
/* run a new query including the search string */
$q = new WP_Query(
'post_type' => job_post_type_name,
wpmark / wp-enqueue-localised-script.php
Created Oct 21, 2015
Enqueuing a localised script in WordPress
View wp-enqueue-localised-script.php
function myplugin_enqueue_scripts() {
/* hand the js for deleting uploads by ajax */
plugins_url( '/assets/js/nameofjsfile.js', __FILE__ ),
array( 'jquery' ),
You can’t perform that action at this time.