Skip to content

Instantly share code, notes, and snippets.

@robertuniqid
robertuniqid / query.sql
Last active October 25, 2018 22:09
I would love to be able to take the first 8(?) words of the body and copy them over to the Title
UPDATE `wp_posts` SET `post_title` = SUBSTRING_INDEX(PREG_REPLACE('#<[^>]+>#',' ',`post_content`), ' ', 8)
WHERE DATE(`post_date`) > '2000-11-11' AND DATE(`post_date`) < '2007-11-11'
@robertuniqid
robertuniqid / example.php
Created October 26, 2018 18:55
Sales Engine Access Rules PHP Example
<?php
// You'll want to get an User Access Rules Instance list this :
$user_access_rule = new WPEPAddOnSalesEngine\Entity\UserAccess( $user_id );
// Case 1 : Give Access to One-Time Purchases ( not Memberships )
// $post_id = Post Type, if it's a Membership, you can set an Expiration date also.
$user_access_rule->get_post_access_rules( $post_id )->give_access(); // when giving access it will save automatically.
@robertuniqid
robertuniqid / wpep-content-library-integration.php
Created October 31, 2018 21:56
WPEP_Content_Library_Integration
<?php
class WPEPContentLibraryIntegrationExample extends WPEP_Content_Library_Integration {
public $service_name = 'Integration Name';
public $meta_box_active = true; // If you want to integrate with the Content Library without the Metabox, simply set this to false.
public $meta_box_title = 'Integration Name';
public $default_purchase_cta = 'Upgrade Membership Plan';
@robertuniqid
robertuniqid / sample-text.txt
Created November 1, 2018 17:59
5 Languages Sample Text
iPhone XR: The reviews are in
Reviewers around the world have put iPhone XR through its paces and are sharing their impressions of the newest member of the iPhone family. That includes everything from its 6.1-inch Liquid Retina display, advanced camera system that creates dramatic portraits using a single camera lens, all-day battery life and six beautiful finishes; white, black, blue, yellow, coral and (PRODUCT)RED.
Here are some of the reviewers’ reactions:
Digital Trends
“The colors are stunning, battery life is great, Face ID is still industry-leading technology, iOS gestures are intuitive, the camera is superb, and performance is fantastic. This is the iPhone to buy.”
Daring Fireball
@robertuniqid
robertuniqid / style.css
Created November 16, 2018 15:59
WPEP - Disable Index Page Transitions
.wpep-wrapper>.wpep-container .course-grid-container .wpep-course-grid-items-container>div.wpep-visible,
.wpep-wrapper>.wpep-container .course-grid-container .wpep-ebook-grid-items-container>div.wpep-visible,
.wpep-wrapper>.wpep-container .course-grid-container .wpep-list-item-grid-items-container>div.wpep-visible,
.wpep-wrapper>.wpep-container .course-grid-container .wpep-offer-grid-items-container>div.wpep-visible,
.wpep-wrapper>.wpep-container .course-grid-container .wpep-video-grid-items-container>div.wpep-visible,
.wpep-wrapper>.wpep-container .course-grid-container .wpep-course-grid-items-container>div.wpep-hidden,
.wpep-wrapper>.wpep-container .course-grid-container .wpep-ebook-grid-items-container>div.wpep-hidden,
.wpep-wrapper>.wpep-container .course-grid-container .wpep-list-item-grid-items-container>div.wpep-hidden,
.wpep-wrapper>.wpep-container .course-grid-container .wpep-offer-grid-items-container>div.wpep-hidden,
.wpep-wrapper>.wpep-container .course-grid-container .wpep-video-grid-items-contai
@robertuniqid
robertuniqid / wpep-course-example.php
Created November 27, 2018 21:57
WordPress Clear oEmbed Cache Automatically on Post Save
<?php
add_action( 'save_post', function( $post_id ) {
if( get_post_type( $post_id ) != WPEP_POST_TYPE_COURSE )
return;
global $wpdb;
$wpdb->query( 'DELETE FROM `' . $wpdb->postmeta . '` WHERE `meta_key` LIKE "_oembed%" AND post_id = ' . $post_id );
});
@robertuniqid
robertuniqid / example.html
Created November 29, 2018 12:20
WPEP - DigiMember Display only Purchased Courses
[wpep_digimember_integration_enable_lock][/wpep_digimember_integration_enable_lock]
[wpep_index]
[wpep_digimember_integration_disable_lock][/wpep_digimember_integration_disable_lock]
@robertuniqid
robertuniqid / log.txt
Created December 27, 2018 11:52
WPEP 1.11.13 -> 1.11.14.1
= 1.11.14.1 =
* Resolved Index Page Course Progress Bar fill error.
= 1.11.14 =
* New Discussion Notifications systems.
* New Discussions Design
* New Course Discussions
* WPEP Content Types can now be filtered by Category.
@robertuniqid
robertuniqid / example.html
Last active December 30, 2018 14:25
Automatically Add $_GET Url Params from current request to all same-domain links on the page, that are part of a whitelist. HTML & JS code is exactly the same, simply copy-paste for non-teechies.
<script type="text/javascript">
// The URL Params you want to whitelist, it will apply them on all links on the same domain.
function rl_whitelisted_url_params() {
return [ 'example-url-param', 'example-url-param-2', 'example-url-param-3' ];
}
function rl_get_url_param(parameterName) {
var result = null,
tmp = [],
items = location.search.substr(1).split("&");
@robertuniqid
robertuniqid / example.php
Created January 8, 2019 11:07
PHP WordPress Example Nested parent->id mapping
<?php
/**
* If WordPress will ever work smoothly with procedures, we want to refactor this.
* @param $search_term
* @return array
*/
function example_nested_parent_map_search( $search_term ) {
global $wpdb;