Skip to content

Instantly share code, notes, and snippets.

View wplit's full-sized avatar
💭
I may be slow to respond.

David Browne wplit

💭
I may be slow to respond.
View GitHub Profile
@wplit
wplit / mp.php
Last active September 24, 2024 01:25
allow people to purchase one individual tutorial by purchasing one membership
<?php
/* General idea
1. Create new membership called 'Single tutorial'.
2. In settings, make sure this membership can be purchased multiple times by same user.
2. Add a custom field to that registration form in settings, a text field named 'tutorial' for the post ID being purchased.
3. User will arrive at the form, with this tutorial custom field pre-filled based on the link they clicked from /?tutorial=POSTID
4. User meta data will store an array of post ids that user has purchased 'users_tutorials'.
5. Use the 'mepr-pre-run-rule-content' filter, to unblock any post for those users that have purchased
@wplit
wplit / footer-scripts.html
Created September 17, 2024 06:27
re-init pro slider when facets are used on slides
@wplit
wplit / video.html
Last active September 15, 2024 11:49
<link rel="stylesheet" href="https://cdn.vidstack.io/player/theme.css" />
<link rel="stylesheet" href="https://cdn.vidstack.io/player/video.css" />
<script src="https://cdn.vidstack.io/player" type="module"></script>
<media-player
playsinline
load="play"
title="Sprite Fight"
src="youtube/_cMxraX_5RE"
@wplit
wplit / footer-scripts.html
Last active September 12, 2024 23:12
prevent any scrolling on read more expand (add to page settings > custom code > footer scripts)
@wplit
wplit / footer-scripts.html
Last active September 11, 2024 01:58
adding margin to header/content/footer on offcanvas open.
@wplit
wplit / footer-scripts.html
Last active September 10, 2024 22:43
initialise pro forms when lightbox opens (add to page settings > custom code > footer scripts)
@wplit
wplit / code.php
Created September 9, 2024 23:35
change wp adjacent post order to be menu order instead of of post date
<?php
function my_previous_post_where() {
global $post, $wpdb;
return $wpdb->prepare( "WHERE p.menu_order < %s AND p.post_type = %s AND p.post_status = 'publish'", $post->menu_order, $post->post_type);
}
add_filter( 'get_previous_post_where', 'my_previous_post_where' );
@wplit
wplit / footer-scripts.html
Last active September 4, 2024 23:24
reset focus back to body element on back to top scrolled
@wplit
wplit / footer-scripts.html
Last active September 3, 2024 06:21
run modal function again when new form appended to the page. (add to page settings > custom code > footer scripts)
@wplit
wplit / footer-scripts.html
Last active September 1, 2024 01:55
Init pro forms when appended inside popover (add to page settings > custom code > footer scripts)