Skip to content

Instantly share code, notes, and snippets.

View wpmark's full-sized avatar

Mark Wilkinson wpmark

View GitHub Profile
@wpmark
wpmark / gist:9069976
Created February 18, 2014 12:22
Change Whistles WordPress Plugin Post Type Labels
<?php
/***************************************************************
* 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';
@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"]
@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;
}
@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"]=>
@wpmark
wpmark / gist:aa388261d0ef58938218
Last active August 29, 2015 14:06
Show Only 5 Blog Posts on Home Page
<?php
/***************************************************************
* Function wpmark_alter_homepage_posts_query()
* Alter query on homepage for show just 5 posts
***************************************************************/
function wpmark_alter_homepage_posts_query( $query ) {
/* check this is not the main query, the admin - if so bail early */
if( ! $query->is_main_query() || is_admin() )
return;
@wpmark
wpmark / latest-tweets-follow-button.php
Created October 8, 2014 09:31
Latest Tweets Widget - Add Follow Button
/***************************************************************
* Function seis_tweets_follow_buttons()
* Adds follow buttons using images from theme image folder with
* names based on the twitter handle given in the widget.
***************************************************************/
function seis_tweets_follow_buttons( $items, $screen_name ) {
/* make the screen name lower case */
$screen_name = strtolower( $screen_name );