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 / wp-featured-image-url.php
Created Nov 18, 2012
Get WordPress Featured Image URL
View wp-featured-image-url.php
wpmark / mdw_user_has_blog_role.php
Created Nov 22, 2012
Check User is a Blog User on Network Site
View mdw_user_has_blog_role.php
/* protects site from those who are not assigned to it */
function mdw_user_has_blog_role() {
/* get the global blog id */
global $blog_id;
/* check user is part of this blog, and die if they are not */
if( ! is_blog_user( $blog_id ) )
wp_die( __("You are trying to access a site that you are not allowed to see. Naughty you!") );
wpmark / gist:4534059
Last active Dec 11, 2015
Adding a Custom table in WordPress using a WordPress plugin.
View gist:4534059
function wpct_create_db_table() {
global $wpdb;
/* create the table name using the wordpress table prefix for this site */
$wpct_tablename = $wpdb->prefix . "wpct";
/* setup the structure of the table creating these as a variable */
wpmark / gist:4534269
Created Jan 14, 2013
Add data to a Custom WordPress table
View gist:4534269
/* create a function to get the values from this page load */
function wpct_track_content() {
/* call the global post variable to gain access to post data */
global $post;
/* setup an array to store all our values */
$wpct_post_values = array();
wpmark / gist:5007195
Last active Jul 26, 2017
Plugin to add a dropdown list of users in the WordPress admin bar with a link to switch to that user (requires the User Switching plugin by
View gist:5007195
Plugin Name: User Switching in Admin Bar
Plugin URI:
Description: Build upon the User Switching plugin ( by John Blackbourn and adds a dropdown list of users in the WordPress admin bar with a link to switch to that user.
Author: Mark Wilkinson
Author URI:
Version: 1.0
wpmark / wp-sidebar-menu.php
Created Oct 20, 2013
WordPress Sidebar Menu for Pages
View wp-sidebar-menu.php
/* check whether the current post has a parent */
if( $post->post_parent ) {
/* get the ancestors/parent of the current post */
$pxjn_ancestors = get_post_ancestors( $post->ID );
/* count the number of parents retrieved less 1 */
$pxjn_root = count( $pxjn_ancestors ) -1;
wpmark / gist:8160972
Last active Sep 9, 2017
Remove WordPress admin menu items for certain users.
View gist:8160972
/* add our function to the admin meny action */
add_action( 'admin_menu', 'pxjn_remove_menus', 999 );
function pxjn_remove_menus() {
/* get the current user id */
$pxjn_current_user_id = $current_user->ID; // get the user ID
wpmark / local-config.php
Created Jan 10, 2014
Local Config file for WordPress Multisite.
View local-config.php
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'db_name');
/** MySQL database username */
define('DB_USER', 'db_user');
/** MySQL database password */
define('DB_PASSWORD', 'db_password');
wpmark / mdw-activation-plugin.php
Last active Jan 3, 2016
Plugin which runs a function to activate other plugins when new sites are created.
View mdw-activation-plugin.php
Plugin Name: Multisite Site Creation Activation Plugin
Plugin URI:
Description: Plugin which runs a function to activate other plugins when new sites are created.
Version: 1.0
Author: Mark Wilkinson
Author URI:
License: GPLv2 or later
wpmark / gist:9069976
Created Feb 18, 2014
Change Whistles WordPress Plugin Post Type Labels
View gist:9069976
* Function pxlcore_whistles_post_labels()
* Changes the post labels for the Whistles post type.
function pxlcore_whistles_post_labels( $labels ) {
$labels->name = 'Snippets';
$labels->singular_name = 'Snippet';
$labels->menu_name = 'Snippets';
You can’t perform that action at this time.