Skip to content

Instantly share code, notes, and snippets.

View Lonsdale201's full-sized avatar

Soczó Lonsdale201

View GitHub Profile
@Lonsdale201
Lonsdale201 / gist:4707959f44a93a363e71347e0bd33123
Created November 9, 2023 23:59
WooCommerce Points and Rewards get current user point balance shortcode
function hw_current_user_points_shortcode() {
// Csak bejelentkezett felhasználóknál jelenjen meg valami
if ( is_user_logged_in() ) {
$user_id = get_current_user_id();
// A felhasználó pontegyenlegének lekérdezése a WC_Points_Rewards_Manager osztály használatával
$points = WC_Points_Rewards_Manager::get_users_points( $user_id );
// Ellenőrizzük, hogy a felhasználónak van-e pontja
if ( empty( $points ) ) {
@Lonsdale201
Lonsdale201 / gist:cd73b2340a0ca12697a3c92763c61dea
Last active November 23, 2023 13:10
JetSmartfilter Checkbox filter - Group parent toggle
// make your Checkbox filter, and ensure that "Group terms by parents" option is checkhed.
// In the Checkbox filter widget enable the Dropdown additions. You can use the search option also. (Mixed filter type not tested)
// Paste this code in a specific js file, plugin, or use the Elementor custom code function. (if elementor custom code, dont forget to
// use the tags, like <script> and <style>
// Multi level not tested, only one level.
// Warning this script will affect all of your checkbox filter, where you settinged up the "Group terms by parents" option.
// PREVIEW : https://prnt.sc/5fPJ6iebdDCy
@Lonsdale201
Lonsdale201 / gist:aa2740c1fe926b74d79971356fea304e
Created November 22, 2023 20:14
Elementor Wordpress menü widget kattintás szimuláció
// az elem, amire kattintva, szimulációt kell leadni az elementor Wp menü widgetre, add meg ezt az ID: triggerelement
// másold a kódot egy megfelelő js fájlba vagy használd az Elementor custom code funkciót
// verzió 1 csak kinyitás
<script>
document.addEventListener('DOMContentLoaded', function () {
var triggerElement = document.getElementById('triggerelement');
if (triggerElement) {
@Lonsdale201
Lonsdale201 / gist:492fd40b98b47c52b8bc963b35522955
Created November 28, 2023 10:06
JetEngine - Custom Macro - Current user email
add_action( 'jet-engine/register-macros', function(){
class Current_User_Email extends \Jet_Engine_Base_Macros {
public function macros_tag() {
return 'current_user_email';
}
public function macros_name() {
return 'Current user email';
@Lonsdale201
Lonsdale201 / gist:24c66ac2f324de52d8585916a5d21a96
Last active November 28, 2023 12:42
JetEngine - Custom Macro - Current user Membership
// place the code in the child theme functions.php or a custom code snippets plugin.
// how to use
// Create a new User Query in the Query builder.
// Go to the Include/exclude section
// Click the Dynamic tag icon, and select the WC Current User membership macro. In the text field write your membership ID and done.
// Include or Exclude can apply this macro.
// This macro will return the selected user id
// If the membership ID not exist, or not have user with selected ID membership active, will return
// My all Gist: https://gist.github.com/Lonsdale201
@Lonsdale201
Lonsdale201 / gist:726c1ddfe03b18145759a94357477fb6
Created November 28, 2023 12:38
JetEngine - Custom Macro - Current user Memberships (multiple support)
// place the code in the child theme functions.php or a custom code snippets plugin.
// how to use
// Create a new User Query in the Query builder.
// Go to the Include/exclude section
// Click the Dynamic tag icon, and select the WC Current User memberships macro. In the text field write your membership IDs and done.
// this version can handle multiple memberip id's
// Include or Exclude can apply this macro.
// This macro will return the selected user id
// If the membership ID not exist, or not have user with selected ID membership active, will return
// My all Gist: https://gist.github.com/Lonsdale201
@Lonsdale201
Lonsdale201 / gist:c708544e74429ff2d6abb43d3fd8f84e
Created November 28, 2023 13:19
JetEngine - Custom Macro - User Purchased Any Product
// place the code in the child theme functions.php or a custom code snippets plugin.
// This macro will return the users who are purchased any product on your website (and can select the order status)
// how to use
// Create a new User Query in the Query builder.
// Go to the Include/exclude section
// Click the Dynamic tag icon, and select the WC User Purchased Any Product macro. In the select field choose the order status, or use the "All" option
// This macro will return the selected user id
@Lonsdale201
Lonsdale201 / gist:0e23048f1ff1597087e1a396bd41a66b
Created November 28, 2023 19:16
JetEngine - Custom Macro - Learndash - Current user all purchased courses
// place the code in the child theme functions.php or a custom code snippets plugin.
// how to use
// Create a new Post Query in the Query builder. Select the post type: Course
// Go to the Meta Query section
// click the Add new button
// in the VALUE field choose the Dynamic tag icon, and select LD User Courses Access
// In the operator field select the "in the list" option
// HELP IMAGE : https://prnt.sc/3g_INGSx_yNb
// DONE
@Lonsdale201
Lonsdale201 / gist:3f1fa827344b87e987df104237b43dbf
Created November 28, 2023 21:06
Custom Macro - Learndash - Current user courses with selectable progress
// place the code in the child theme functions.php or a custom code snippets plugin.
// how to use
// Create a new Post Query in the Query builder. Select the post type: Course
// Go to the Meta Query section
// click the Add new button
// in the VALUE field choose the Dynamic tag icon, and select LD Current User Courses and status
// Choose what type of progress you want to show
// In the operator field select the "in the list" option
// HELP IMAGE : https://prnt.sc/sIGKdV44yi51
// DONE
@Lonsdale201
Lonsdale201 / gist:7a9642c64e9950fafcce14f6405111ab
Last active November 28, 2023 22:10
JetEngine - Learndash - Dynamic visibility - Current user current course purchased
// place the code in the child theme functions.php or a custom code snippets plugin.
// how to use
// Go to the Elementor Course single template
// Select your widget, or container whatever.
// Go to the advanced tab, select the JetEngine Dynamic visibility
// Scroll down under the list, where you find a new Learndash Category.
// Select the Current user purchased this course option
// Setup your logic: Show or hide
// So, this condition, based on the fact that the current user has purchased the course they are on.