Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View birgire's full-sized avatar

Birgir Erlendsson birgire

View GitHub Profile
[wpse_playlist type="audio" tracklist="true" tracknumbers="true" images="true" artist="true"]
[wpse_trac title="Ain't Misbehavin'" src="//s.w.org/images/core/3.9/AintMisbehavin.mp3" type="audio/mpeg" caption="" description="" image="" meta_artist="Louis Armstrong and His Orchestra" meta_album="78 RPMs and Cylinder Recordings" meta_genre="" meta_length_formatted="3:21" image_src="//s.w.org/images/core/3.9/louis.jpg" image_width="308" image_height="240" thumb_src="//s.w.org/images/core/3.9/louis.jpg" thumb_width="308" thumb_height="240"]
[wpse_trac title="Buddy Bolden's Blues" src="//s.w.org/images/core/3.9/JellyRollMorton-BuddyBoldensBlues.mp3" type="audio/mpeg" caption="" description="" image="" meta_artist="Jelly Roll Morten" meta_album="78 RPMs and Cylinder Recordings" meta_genre="Jazz" meta_length_formatted="2:09"]
[/wpse_playlist]
@birgire
birgire / WordPress: Replace viper's quick tags with the native video shortcode
Last active August 29, 2015 14:02
WordPress: Replace Viper's quick tags (youtube, vimeoh, veoh, viddler) with the native video shortcode.
<?php
/**
* Plugin Name: Replace Viper's Video Quicktags
* Description: Replace Viper's video quicktags (youtube, vimeo, viddler, veoh) with the native video tag [video src="..."]
* Author: birgire
* Author URI: https://gist.github.com/birgire
* Plugin URI: https://gist.github.com/birgire/05300dee75b62fab795b
* Version: 0.0.3
*
* Examples:
<?php
/**
* Plugin Name: WPSE Playlist shortcode for external files - a single file with PHP 5.2.x support
* Description: This plugin allows you to use external audio or video files with the native WordPress playlist, through the use of the [wpse_playlist] and [wpse_trac] shortcodes.
* Plugin URI: https://gist.github.com/birgire/fbd961bc682276830a0d/
* Author: birgire
* Author URI: https://github.com/birgire
* Version: 0.0.5b
*/
@birgire
birgire / method1.php
Last active October 13, 2019 04:46
Change Parent Name with wp_list_pages?
<?php
/**
* Method 1: Use the the_title() filter to modify the first link name in wp_list_pages().
*
* @see http://wordpress.stackexchange.com/questions/156742/change-parent-name-with-wp-list-pages
*/
// -----------------------------------------
// Place this wpse_title() function definition into
// the functions.php file in the current theme directory.
@birgire
birgire / wp-plugin-woo-product-attributes-debug.php
Last active August 29, 2015 14:05
WooCommerce Product Attributes - Dump them in a metabox for debugging
<?php
/**
* Plugin Name: Product Attributes - Debug
* Description: Dump the product attributes in a metabox.
* Author: birgire
* Author URI: Https://github.com/birgire
* Version: 0.0.1
*/
// PHP 5.3.3+
@birgire
birgire / functions.php
Last active December 4, 2018 16:44
WordPress: The Sponsor Posts Injector plugin
/**
* The Sponsor Posts Injector - Usage Example
*
* @version 0.0.3
* @uses content-sponsor.php
* @file functions.php
* @see http://wordpress.stackexchange.com/q/158133/26350
*/
/**
@birgire
birgire / wpse-current-child-pages-metabox.php
Last active August 29, 2015 14:05
WordPress: Child Pages Meta Box For Hierarchial Post Types
<?php
/**
* Plugin Name: Child Pages Meta Box
* Description: Child pages meta box for hierarchial post types
* Author: Birgir Erlendsson (birgire)
* Plugin URI: http://wordpress.stackexchange.com/a/158636/26350
* Version: 0.0.2
*/
@birgire
birgire / functions.php
Last active August 29, 2015 14:05
Fetch taxonomy terms statistics for all posts before due date, with a single database query.
/**
* Fetch taxonomy terms statistics for all posts before due date, with a single database query.
*
* Assumes that the 'due' values are saved as YYYYMMDD
*
* @see http://www.wpquestions.com/question/showChronoLoggedIn/id/9770
* @param string $taxonomy
* @param string $meta_key
* @return mixed Database query results
* @version 0.0.2
@birgire
birgire / comment-reply-mod.js
Last active February 11, 2019 16:55
WordPress: Modified addComment Javascript function.
var addComment = {
moveForm : function(commId, parentId, respondId, postId) {
var t = this, div, comm = t.I(commId), respond = t.I(respondId), cancel = t.I('cancel-comment-reply-link'), parent = t.I('comment_parent'), post = t.I('comment_post_ID');
if ( ! comm || ! respond || ! cancel || ! parent )
return;
t.respondId = respondId;
postId = postId || false;
@birgire
birgire / function-merge-user-edits.php
Last active August 29, 2015 14:05
WordPress: Merge array edits made by a given user.
/**
* function merge_user_edits()
*
* Merge the user edits to the existing meta data:
*
* @author birgire
* @version 0.0.1
* @param integer $user_id
* @param array $data
* @param array $edits