Skip to content

Instantly share code, notes, and snippets.

View JiveDig's full-sized avatar

Mike Hemberger JiveDig

View GitHub Profile
@JiveDig
JiveDig / edd_history_shortcode_heading.php
Created July 8, 2014 15:52
Add heading to EDD download history and purchase history shortcodes
<?php
// Do [download_history] heading
add_action( 'edd_before_download_history', 'richr_do_download_history_before' );
function richr_do_download_history_before() {
echo '<h2>Download your files</h2>';
}
// Do [purchase_history] heading
add_action( 'edd_purchase_history_header_before', 'richr_do_purchase_history_before' );
@JiveDig
JiveDig / display_posts_shortcode_title_wrap.php
Created July 8, 2014 17:10
Change Display Posts Shortcode plugin title wrap
<?php
//* Change Display Posts Shortcode plugin title wrap from h2 to h4
add_filter( 'display_posts_shortcode_title_tag', 'richr_do_display_posts_shortcode_title_wrap' );
function richr_do_display_posts_shortcode_title_wrap($title_wrap) {
$title_wrap = 'h4';
return $title_wrap;
}
<?php
function change_author_capabilities() {
$role = get_role( 'author' ) ;
$role->remove_cap( 'edit_published_posts' );
$role->remove_cap( 'publish_posts' );
$role->remove_cap( 'delete_published_posts' );
$role->remove_cap( 'edit_posts' );
$role->remove_cap( 'delete_posts' );
<?php
function change_post_label() {
global $menu;
global $submenu;
$menu[5][0] = 'News';
$submenu['edit.php'][5][0] = 'News';
$submenu['edit.php'][10][0] = 'Add News';
$submenu['edit.php'][16][0] = 'News Tags';
@JiveDig
JiveDig / edd_shop_vendor_delete_products.php
Created July 10, 2014 14:27 — forked from pippinsplugins/functions.php
All Easy Digital Downloads shop vendors to delete products/downloads
<?php
function change_author_capabilities() {
$role = get_role( 'shop_vendor' ) ;
$role->add_cap( 'delete_published_products' );
}
add_action( 'admin_init', 'change_author_capabilities' );
@JiveDig
JiveDig / body_class_admin.php
Created July 10, 2014 17:22
Add body class to admin area
<?php
//* Add custom admin body class to the head
add_filter( 'admin_body_class', 'beats_admin_body_class' );
function beats_admin_body_class( $classes ) {
$classes .= 'beatminded';
return $classes;
}
@JiveDig
JiveDig / default_enable_variable_pricing.php
Created July 16, 2014 14:54
Preset a download to variable pricing on post creation/save
/**
* Preset a download to variable pricing on post creation/save
*
* @since 1.0
*/
add_action( 'save_post', 'beats_preset_variable_pricing', 20, 2 );
function beats_preset_variable_pricing( $post_id ) {
// If this isn't a 'download' post, don't update it.
if( 'download' !== get_post_type() ) {
return;
@JiveDig
JiveDig / add_genesis_content_class.php
Created September 8, 2014 20:49
Add class to .content in Genesis
<?php
//* Add class to .content
add_filter( 'genesis_attr_content', 'beatm_facetwp_class' );
function beatm_facetwp_class( $attributes ) {
$attributes['class'] = $attributes['class']. ' facetwp-template';
return $attributes;
}
@JiveDig
JiveDig / soliloquy_remove_stylesheet.php
Last active August 29, 2015 14:06 — forked from thomasgriffin/gist:7308584
Remove styling and stylesheets in Soliloquy Slider
<?php
add_action( 'tgmsp_before_slider_output', 'tgm_custom_slider_theme' );
function tgm_custom_slider_of_madness( $id ) {
// If not the proper slider ID, do nothing. Change to match your slider ID.
if ( '324' !== $id ) return;
// Dequeue the default styles.
wp_dequeue_style( 'soliloquy-style' );
/* =BEGIN: Check If Page Is Child
Source: http://bavotasan.com/2011/is_child-conditional-function-for-wordpress/
---------------------------------------------------------------------------------------------------- */
function is_child( $page_id_or_slug ) { // $page_id_or_slug = The ID of the page we're looking for pages underneath
global $post; // load details about this page
if ( !is_numeric( $page_id_or_slug ) ) { // Used this code to change a slug to an ID, but had to change is_int to is_numeric for it to work.
$page = get_page_by_path( $page_id_or_slug );
$page_id_or_slug = $page->ID;
}