Skip to content

Instantly share code, notes, and snippets.

Mark Wilkinson wpmark

Block or report user

Report or block wpmark

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wpmark
wpmark / wpbb-salary-field-edit.php
Created Jul 19, 2017
Edit Salary Field in WP Broadbean
View wpbb-salary-field-edit.php
<?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 Dec 16, 2015
Overriding the Markup with the Flexible Featured Post Widget
View ffpw-markup-overide.php
<?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 Nov 26, 2015
wp-config.php change for WordPress in its Own Directory
View wp-in-own-dir.php
<?php
/**
* Bootstrap WordPress
*/
if ( !defined( 'ABSPATH' ) )
define( 'ABSPATH', dirname( __FILE__ ) . '/cms/' );
?>
@wpmark
wpmark / wp-custom-content-folder.php
Created Nov 26, 2015
Custom Content Directory for WordPress
View wp-custom-content-folder.php
<?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 Nov 18, 2015
WP_Query Ordered By Multiple Meta Keys
View wp-query-orderby-muliple-meta-keys.php
<?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',
@wpmark
wpmark / wp-ajax-search-functions-hooked.php
Last active Oct 21, 2015
AJAX Search Function for Post Titles
View wp-ajax-search-functions-hooked.php
<?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(
array(
'post_type' => job_post_type_name,
@wpmark
wpmark / wp-enqueue-localised-script.php
Created Oct 21, 2015
Enqueuing a localised script in WordPress
View wp-enqueue-localised-script.php
<?php
function myplugin_enqueue_scripts() {
/* hand the js for deleting uploads by ajax */
wp_enqueue_script(
'myplugin-utilities-ajax',
plugins_url( '/assets/js/nameofjsfile.js', __FILE__ ),
array( 'jquery' ),
'1.0.0',
true
@wpmark
wpmark / ajax-search.js
Created Oct 21, 2015
Code for Running an AJAX Search in WordPress
View ajax-search.js
( function( $ ) {
// hooks everything into document ready
$(document).ready( function() {
// create a function to actually fire the search
function dosearch(t) {
// do the ajax request for job search
$.ajax({
@wpmark
wpmark / using-media-handle-sideload.php
Created Jul 10, 2015
Using Media Handle Sideload
View using-media-handle-sideload.php
<?php
/* set the url of the file to sideload - probably be from $_POST or something */
$url = 'http://domain.com/image.jpg';
/**
* donwload the url into wordpress
* saved temporarly for now
*/
$tmp = download_url( $url );
@wpmark
wpmark / admin-mu-link-orig-domain.php
Created Jun 25, 2015
Admin Links in Multisite Always go to Original Domain
View admin-mu-link-orig-domain.php
You can’t perform that action at this time.