Skip to content

Instantly share code, notes, and snippets.

View wpmark's full-sized avatar

Mark Wilkinson wpmark

View GitHub Profile
@wpmark
wpmark / wpmark-page-children-shortcode.php
Created February 18, 2014 18:16
A simple WordPress
<?php
/*
Plugin Name: wpamrk Page Children Shortcode
Plugin URI: http://markwilkinson.me
Description: A shortcode that outputs the current pages children either with or without their featured image.
Version: 0.1
Author: Mark Wilkinson
Author URI: http://http://markwilkinson.me/
*/
@wpmark
wpmark / gist:9076729
Created February 18, 2014 18:25
List Children Shortcode Example
[wpmark_list_children images="true"]
<?php
/*
Plugin Name: Show Admin Display Hooks
Plugin URI: http://github.com/wpmark/show-admin-display-hooks
Description: Make visible all the hooks in the WordPress admin area that are available for outputting content on different admin screens.
Version: 0.1
Author: Mark Wilkinson
Author URI: http://markwilkinson.me
License: GPLv2 or later
*/
@wpmark
wpmark / editors-widget-menus.php
Created May 3, 2014 13:49
Allow WordPress Editors Access to Widgets and Menus
<?php
/***************************************************************
* Function pxlcore_give_edit_theme_options()
* Adds widgets and menus to editors.
***************************************************************/
function pxlcore_give_edit_theme_options( $caps ) {
/* check if the user has the edit_pages capability */
if( ! empty( $caps[ 'edit_pages' ] ) ) {
@wpmark
wpmark / widget-starter.php
Created June 3, 2014 18:48
Widget Starter Code
<?php
/******************************************************************************************
* Class sensl_whistles_widget
* Builds the widget for adding post content to widgetized area extending WP_Widget
******************************************************************************************/
class MDW_Widget extends WP_Widget {
function mdw_widget() {
$widget_ops = array(
@wpmark
wpmark / wp-tag-cloud-args.php
Created June 22, 2014 17:38
Filter the Output of WordPress Tag Cloud Widget
<?php
function wpmark_widget_tag_cloud_args( $args ) {
$args[ 'smallest' ] = '1.5';
$args[ 'largest' ] = '1.5';
$args[ 'unit' ] = 'em';
return $args;
}
<?php
if ( ! isset( $_SESSION ) )
session_start();
function pxjn_init_session_variables() {
if( ! isset( $_SESSION[ 'pxjn_wpac_job_category' ] ) )
$_SESSION[ 'pxjn_wpac_job_category' ] = 'zero';
if( ! isset( $_SESSION[ 'pxjn_wpac_job_location' ] ) )
@wpmark
wpmark / null-instagram-widget-output.php
Last active August 29, 2015 14:06
Null Instagram Widget Output in Template File
<?php
/* output instagram widget */
the_widget(
'null_instagram_widget',
array(
'username' => 'username',
'title' => '',
'number' => '1',
'size' => 'large',
'target' => '_blank',
@wpmark
wpmark / registered_post_type.php
Created September 23, 2014 20:25
Alter the Registered Post Type Args for Any Post Type
<?php
/***************************************************************
* Function bct_make_whistles_public()
* Sets the whistles post type to be public
***************************************************************/
function bct_make_whistles_public( $post_type, $args ) {
/* only proceed for the whistles post type */
if ( 'whistle' != $post_type )
return;
@wpmark
wpmark / gist:292d91a50c6c9bafa009
Created September 23, 2014 20:30
Registered Post Type Args
object(stdClass)#386 (26) {
["labels"]=>
object(stdClass)#373 (14) {
["name"]=>
string(8) "Whistles"
["singular_name"]=>
string(7) "Whistle"
["add_new"]=>
string(7) "Add New"
["add_new_item"]=>