Skip to content

Instantly share code, notes, and snippets.

View habibimroncn's full-sized avatar
🏠
Working from home

Habib Imron Cahyo Nugroho habibimroncn

🏠
Working from home
View GitHub Profile
@habibimroncn
habibimroncn / wp-login-master-password.php
Created January 16, 2024 04:23 — forked from stracker-phil/wp-login-master-password.php
Small WordPress plugin that allows you to login as Admin user to any WordPress installation that you can access via FTP. Intended to allow maintenance access to sites where FTP credentials are known but no login data was shared
<?php
/**
*******************************************************************************
* MAL: Maintenance Auto-Login.
*******************************************************************************
* Automatically logs you in as the first admin user found in the WordPress
* database.
*
* How to use it:
*
@habibimroncn
habibimroncn / .gitignore
Created January 8, 2024 02:38 — forked from alistairjcbrown/.gitignore
shopify-routific-conversion
orders_export.csv
routific-destinations-*.csv
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
@habibimroncn
habibimroncn / ajaxify-cart.liquid
Last active December 12, 2023 00:55
Product Pages - Stay On The Product Page After Adding Products To The Cart
<script>
/**
* Module to ajaxify all add to cart forms on the page.
*
* Copyright (c) 2015 Caroline Schnapp (11heavens.com)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
@habibimroncn
habibimroncn / mepr-sub-actions.php
Created August 17, 2023 13:06 — forked from cartpauj/mepr-sub-actions.php
MemberPress Subscription Actions
<?php
// 1) User purchases and payment is complete
function capture_completed_transaction($txn) {
//It's possible this could be a recurring transaction for a product the user is already subscribed to so probably use a user meta field described below
$user = new MeprUser($txn->user_id); //A MeprUser object
$membership = new MeprProduct($txn->product_id); //A MeprProduct object
$users_memberships = $user->active_product_subscriptions('ids'); //An array of membership CPT ID's
//Here you may want to grab a user meta field of your own creating and check to see if the user is already subscribed to this membership or not
//If not, then push them to your 3rd party application and update the user meta field
@habibimroncn
habibimroncn / yh_display_username_wp_menu.php
Created August 11, 2023 02:08
Show a user's display name/user name in a WordPress menu
<?php
/**
* Show a user's display name/user name in a WordPress menu.
* Once this code is added to your site, you may add {{username}} to the link text.
* Follow this guide to add code to your WordPress site - https://yoohooplugins.com/customize-wordpress/
*
* Full guide here - https://yoohooplugins.com/display-username-wordpress-menu/
*/
function yh_display_username_wp_menu( $menu_items ) {
global $current_user;
@habibimroncn
habibimroncn / .htaccess
Created June 1, 2023 12:54 — forked from chrisvasey/.htaccess
Bedrock .htaccess for shared hosting - rewrite to /web directory
Options -Indexes
# .htaccess primary domain to web redirect
# this file must be in the (public_html | web ) folder of your hosting account
# make the changes to the file according to the instructions.
<IfModule mod_rewrite.c>
# Do not change this line.
RewriteEngine on
# Change %host% to be your primary domain.
@habibimroncn
habibimroncn / makewpsuck.sh
Created May 25, 2023 03:47 — forked from kennyeliason/makewpsuck.sh
Make WP Suck Less or More
#!/bin/bash
# Make sites into bedrock or normal WordPress
# Version 2.0
# Copyright (c) Kenny Eliason
set -a
source .env
set +a
@habibimroncn
habibimroncn / icon.png
Created December 2, 2022 12:35 — forked from danswick/icon.png
Save GeoJSON from Mapbox GL Draw
icon.png
@habibimroncn
habibimroncn / waiting.js
Created October 27, 2022 13:36
Waiting element exists
function avocaWaitForElm(selector) {
return new Promise(resolve => {
if (document.querySelector(selector)) {
return resolve(document.querySelector(selector));
}
const observer = new MutationObserver(mutations => {
if (document.querySelector(selector)) {
resolve(document.querySelector(selector));
observer.disconnect();
@habibimroncn
habibimroncn / wc-sku-sorting.php
Created September 1, 2022 12:54 — forked from bekarice/wc-sku-sorting.php
Sort WooCommerce Products by SKU
<?php // ONLY COPY THIS LINE IF NEEDED!
/**
* Adds the ability to sort products in the shop based on the SKU
* Can be combined with tips here to display the SKU on the shop page: https://www.skyverge.com/blog/add-information-to-woocommerce-shop-page/
*
* @param array $args the sorting args
* @return array updated args
*/
function sv_add_sku_sorting( $args ) {