Skip to content

Instantly share code, notes, and snippets.

View labsecrets's full-sized avatar

LabSecrets labsecrets

View GitHub Profile
<?php
/**
* Disable all sales.
*
* A simple function to disable all the sales in the shop.
* Uncomment the line of code to disable the sale price on products.
*/
function custom_wc_get_sale_price( $sale_price, $product ) {
@labsecrets
labsecrets / facebook-comments-like.php
Created January 21, 2018 18:28
Facebook comments and like for LTB...just change the APP ID and URL
<div id="fbComments" style="width:100%px;">
<h3>Questions & Comments</h3>
<div class="fb-like op-fbComments--like" data-href="https://learntobeabookkeeper.com/how-to-develop-an-abundance-mindset/" data-colorscheme="" data-layout="standard" data-action="like" data-show-faces="false"></div>
<fb:comments href="https://learntobeabookkeeper.com/how-to-develop-an-abundance-mindset/" num_posts="20" publish_feed="true" migrated="1" data-width="100%" data-order-by="reverse_time" class="op-fbComments--comments"></fb:comments>
</div>
@labsecrets
labsecrets / lab-cpt-sticky-post-list
Last active August 29, 2015 14:18
Create And Display List Of Custom Post Types (excluding sticky posts) (see: https://1wd.tv/wordpress-sticky-posts-and-custom-wp-queries/)
// Code To Display Sticky Posts For All Custom Post Types
function lab_latest_sticky_all() {
$args = array(
'post__in' => get_option( 'sticky_posts' ),
'showposts' => 4,
'post_type' => array ('download','post', 'page', 'latest', 'topic', 'forum', 'webinars', 'hangouts', 'lessons', 'kits'),
'ignore_sticky_posts' => 1
);
$the_query = new WP_Query( $args );
while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
@labsecrets
labsecrets / toolkit-bootstrap-vertical-menu
Created March 19, 2015 14:24
Bootstrap Vertical Tab Menu
<style>
/* Vertical Tab Toolkit */
#toolkit {
color: #828282;
font-family: "Montserrat",Arial,sans-serif;
}
#toolkit .container {
max-width: 1040px;
@labsecrets
labsecrets / pmpro-default-wp-role
Last active August 29, 2015 14:16
Paid Memberships Pro - Set Default WP Role to Membership Levels
function assign_pmpro_level_to_role($user_id, $role, $old_roles)
{
global $current_user;
//checks if the user doesn't have a membership level yet
if(!$current_user->ID) {
//we found a role related to pmpro level
if($role == "customer")
{
pmpro_changeMembershipLevel(20, $user_id); //gives default customers the level 20 free registration membership
@labsecrets
labsecrets / gist:f1f982db45ab1c6a9712
Last active August 29, 2015 14:12
WordPress remove wpautop <p> tags around buttons
/*-- http://wordpress.stackexchange.com/questions/130075/stop-wordpress-automatically-adding-br-tags-to-post-content ---*/
remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );
function wpse_wpautop_nobr( $content ) {
return wpautop( $content, false );
}
add_filter( 'the_content', 'wpse_wpautop_nobr' );
<?php
/*
Plugin Name: PMPro Customizations
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Custom Prorating Code and Other Code for PMPro
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
/*
Set levels as "all access levels" so members of these levels will be able to view all Addon Packages.
Requires Paid Memberships Pro and the pmpro-addon-packages plugin.
*/
function my_pmproap_all_access_levels($levels, $user_id, $post_id)
{
//I'm just adding the level, but I could do some calculation based on the user and post id to programatically give access to content
$levels = array(16);
return $levels;
}
/*
Only let level 1 members sign up if they use a discount code.
Place this code in your active theme's functions.php or a custom plugin.
*/
function my_pmpro_registration_checks_require_code_to_register($pmpro_continue_registration)
{
//only bother if things are okay so far
if(!$pmpro_continue_registration)
return $pmpro_continue_registration;
<!DOCTYPE html>
<html>
<head>
<title>Wistia Upload Widget via API </title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<style>
#wistia { width: 500px; height: 75px; }
</style>
</head>
<body>