Skip to content

Instantly share code, notes, and snippets.

View adicahyaludin's full-sized avatar
🏕️
Working from anywhere

Adi Cahyaludin adicahyaludin

🏕️
Working from anywhere
View GitHub Profile
@adicahyaludin
adicahyaludin / wc-order-payment-link.php
Created July 22, 2024 06:40
wc-order-payment-link
@adicahyaludin
adicahyaludin / wp-jquery-nested-sortable.php
Created July 19, 2024 06:47
wp jquery nested sortable
add_action('admin_menu', 'smooth_nested_sortable_menu');
function smooth_nested_sortable_menu()
{
add_menu_page(
'Smooth Nested Sortable', // Page title
'Nested Sortable', // Menu title
'manage_options', // Capability
'smooth-nested-sortable', // Menu slug
'smooth_nested_sortable_page', // Function to display the content
@adicahyaludin
adicahyaludin / capture-web-to-pdf.js
Created November 11, 2023 05:13
capture web to pdf
const puppeteer = require('puppeteer');
const { PDFDocument } = require('pdf-lib');
const fs = require('fs');
(async () => {
const url = 'https://orangerdev.space/cv-style-1/';
// Membuka browser dan halaman baru
const browser = await puppeteer.launch({
args: ['--disable-web-security']
@adicahyaludin
adicahyaludin / textarea-to-array.php
Created March 30, 2023 08:40
textarea to array in php
<?php
$textarea_string = 'lorem
ipsum
dolor
sit
amet';
$textarea_arr = preg_split('/[\r\n]+/', $textarea_string, -1, PREG_SPLIT_NO_EMPTY);
@adicahyaludin
adicahyaludin / vertical-scrollable-element.css
Created November 24, 2022 14:32
Vertical scrollable element with custom scroll css style
/*
vertical scrollable menu
*/
.tokenz-vertical-scrollable-menu ul::-webkit-scrollbar-thumb {
background-color: darkgrey !important;
outline: 0px solid slategrey !important;
}
.tokenz-vertical-scrollable-menu ul::-webkit-scrollbar-track {
box-shadow: inset 0 0 6px rgb(0 0 0 / 30%) !important;
}
<?php
namespace Tokenz\Model;
/**
* User_Verification classes
* @since 1.0.0
*/
class User_Verification {
@adicahyaludin
adicahyaludin / nav-number.php
Created October 5, 2021 17:55
php nav number
<?php
$max_num_pages = $results->max_num_pages; // total max pages
$pg = $pg; // current page
$min_nav = $pg-2;
if ( $min_nav < 1 ) :
$min_nav = 1;
endif;
$max_nav = $pg+2;
@adicahyaludin
adicahyaludin / visitor-ip-geolocation.php
Created April 4, 2021 14:23
get visitor ip public & geolocation by API PHP
<?php
function vcwpk_get_visitor_ip() {
$ipaddress = file_get_contents('https://api.ipify.org');
if ( ! $ipaddress ) :
if (getenv('HTTP_CLIENT_IP'))
$ipaddress = getenv('HTTP_CLIENT_IP');
@adicahyaludin
adicahyaludin / wp post query where authors or category with wpdb
Created August 17, 2020 03:06
wp post query where authors or category with wpdb
$cat_ids = "11,12,13";
$author_ids = "1,2,3";
$length = 8;
$offset = 0;
global $wpdb;
$sql = "SELECT *
FROM $wpdb->posts
define( 'FS_METHOD', 'direct' );