Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Cannon michael-cannon

View GitHub Profile
@michael-cannon
michael-cannon / cbqe-learndash-lms.php
Last active Feb 3, 2021
LearnDash LMS for Custom Bulk/Quick Edit plugin
View cbqe-learndash-lms.php
<?php
/**
* LearnDash LMS for Custom Bulk/Quick Edit plugin
*
* Download and unpack this Gist into your theme folder. Then include this script itself in your theme's `functions.php` file via…
*
* require_once get_stylesheet_directory() . '/35b676bb68eee50737f3/cbqe-learndash-lms.php';
*
* In WordPress Admin > Settings > Custom Bulk/Quick, configure your fields as needed, per below. If configuration updates are needed, either manually edit them or remove the current field configuration and click Save Changes for automatic updates.
*
@michael-cannon
michael-cannon / quick_edit.js
Last active Apr 15, 2020
Working WordPress bulk and quick edit example for a video custom post type. http://aihr.us/wordpress/working-examples-for-wordpress-bulk-and-quick-edit/
View quick_edit.js
// @ref http://rachelcarden.com/2012/03/manage-wordpress-posts-using-bulk-edit-and-quick-edit/
(function($) {
// we create a copy of the WP inline edit post function
var $wp_inline_edit = inlineEditPost.edit;
// and then we overwrite the function with our own code
inlineEditPost.edit = function( id ) {
// "call" the original WP edit function
// we don't want to leave WordPress hanging
$wp_inline_edit.apply( this, arguments );
@michael-cannon
michael-cannon / tw_remove_menu_pages.php
Created Sep 25, 2013
Remove custom post type submenu pages.
View tw_remove_menu_pages.php
<?php
function tw_remove_menu_pages() {
// remove testimonials menu section
// remove_menu_page( 'edit.php?post_type=testimonials-widget' );
// remove categories
remove_submenu_page( 'edit.php?post_type=testimonials-widget', 'edit-tags.php?taxonomy=category&amp;post_type=testimonials-widget' );
// remove tags
View purge-wp-transients.php
<?php
/*
Plugin Name: Purge Transients
Description: Purge old transients
Version: 0.1
Author: Seebz
*/
@michael-cannon
michael-cannon / gist:4025132
Created Nov 6, 2012
Import image keywords as alternate text and tags in WordPress - makes tags available in attachments
View gist:4025132
function register_attachment_taxonomy() {
add_post_type_support('attachment', 'post_tag');
register_taxonomy_for_object_type('post_tag', 'attachment');
}
add_action('admin_init', 'register_attachment_taxonomy');
// add_filter('wp_read_image_metadata', 'read_all_image_metadata', '', 3);
function add_attachment_post_tags( $meta, $attachment_id ) {
@michael-cannon
michael-cannon / cbqe_menu_swapper.php
Last active Dec 25, 2015
Menu Swapper adaption for Custom Bulk/Quick Edit
View cbqe_menu_swapper.php
<?php
/**
* Menu Swapper adaption for Custom Bulk/Quick Edit Premium
*
* @author Michael Cannon <mc@aihr.us>
* @ref http://wordpress.org/plugins/menu-swapper/
* @ref http://wordpress.org/plugins/custom-bulkquick-edit/
* @ref http://aihr.us/products/custom-bulkquick-edit-premium-wordpress-plugin/
*/
@michael-cannon
michael-cannon / cbqe_post_types_ignore.php
Created Oct 15, 2013
Filter `cbqe_post_types_ignore` Customize the ignored post_types array.
View cbqe_post_types_ignore.php
<?php
add_filter( 'cbqe_post_types_ignore', 'bhc_cbqe_post_types_ignore' );
function bhc_cbqe_post_types_ignore( $post_types ) {
foreach ( $post_types as $key => $value ) {
if ( 'page' == $value )
unset( $post_types[ $key ] );
}
return $post_types;
}
@michael-cannon
michael-cannon / twp_remove_donate.php
Created Sep 10, 2013
How do you remove the donate button from Testimonials Widget Premium?
View twp_remove_donate.php
<?php
add_action( 'plugins_loaded', 'twp_remove_donate', 25 );
function twp_remove_donate() {
global $TW_Premium;
remove_filter( 'plugin_row_meta', array( $TW_Premium, 'plugin_row_meta' ), 10, 2 );
}
?>
View cbqe_quick_edit_custom_box_field.php
<?php
add_filter( 'cbqe_quick_edit_custom_box_field', array( $this, 'quick_edit_custom_box_field' ), 10, 5 );
public function quick_edit_custom_box_field( $input, $field_type, $field_name, $options, $bulk_mode ) {
$result = '';
switch ( $field_type ) {
case 'date':
$result = '<input type="text" class="datepicker" name="' . $field_name . '" autocomplete="off" />';
break;
View cbqe_get_post_types_args.php
<?php
add_filter( 'cbqe_get_post_types_args', array( $this, 'get_post_types_args' ) );
public function get_post_types_args( $args ) {
$args[ 'exclude_from_search' ] = true;
return $args;
}
?>