Skip to content

Instantly share code, notes, and snippets.

Avatar
🎧
Working from home

David Chandra Purnama turtlepod

🎧
Working from home
View GitHub Profile
@turtlepod
turtlepod / composer.json
Created Sep 26, 2020
Contoh Composer dari tutorial youtube.
View composer.json
{
"name": "test-plugin-wpcs",
"description": "Plugin with WPCS",
"authors": [
{
"name": "Author",
"email": "david@shellcreeper.com"
}
],
"require": {
View metabox-my-data.php
<?php
add_action( 'init', function() {
// Add field:
add_action( 'add_meta_boxes', function() {
add_meta_box(
'my_meta_box',
'My Meta Box',
function( $post ) {
wp_nonce_field( __FILE__, '_my_data_nonce' );
?>
View make-cert.bat
@echo off
set /p domain="Enter Domain: "
set OPENSSL_CONF=../conf/openssl.cnf
if not exist .\%domain% mkdir .\%domain%
..\bin\openssl req -config cert.conf -new -sha256 -newkey rsa:2048 -nodes -keyout %domain%\server.key -x509 -days 3650 -out %domain%\server.crt
echo.
echo -----
View cert.conf
[ req ]
default_bits = 2048
default_keyfile = server-key.pem
distinguished_name = subject
req_extensions = req_ext
x509_extensions = x509_ext
string_mask = utf8only
[ subject ]
@turtlepod
turtlepod / functions.php
Last active Aug 18, 2019
Listify Snippet: Very Raw Idea (consider this as proof of concept) In How to Create Custom Locate Me Button To Get Only City Name.
View functions.php
<?php
add_action( 'wp_footer', function() {
?>
<script>
jQuery( document ).ready( function($) {
// Add custom locate me button.
$( '.search_location' ).append( '<i class="locate-me-too"></i>' );
@turtlepod
turtlepod / some.php
Created Nov 14, 2017
Listify FacetWP: Listings Template Query
View some.php
<?php
return array(
'post_type' => 'job_listing',
'orderby' => array( 'menu_order' => 'ASC', 'date' => 'DESC' ),
'order' => 'asc',
'post_status' => 'publish'
);
@turtlepod
turtlepod / functions.php
Last active Nov 14, 2017
Listify Snippet: Change Location Field to Address
View functions.php
<?php
/**
* Change The Location Fields to "Address"
*
* @link https://gist.github.com/turtlepod/e05053729577fdbf2daa604bb32271b7
*/
add_action( 'init', function() {
@turtlepod
turtlepod / functions.php
Created Nov 13, 2017
Listify Snippet: Remove Location Facets
View functions.php
<?php
// Filter registered facets.
add_filter( 'facetwp_facets', function( $facets ) {
/**
* Loop each facets.
* Listify facets are "keyword", "location", and "category"
*/
foreach ( $facets as $index => $facet ) {
@turtlepod
turtlepod / functions.php
Last active Dec 30, 2018
Listify Snippet: Add Listing Category in Listing Card
View functions.php
<?php
/**
* Add Category List To Listing Data.
*
* @link https://gist.github.com/turtlepod/0642d19439de6b96da06342619ed705a
*/
add_filter( 'listify_get_listing_to_array', function( $data, $listing ) {
@turtlepod
turtlepod / functions.php
Last active Nov 3, 2017
Listify: Remove Types Filter & Labels Filters
View functions.php
<?php
/**
* Remove Types Filter Fields
*
* @link https://gist.github.com/turtlepod/94a6dcf29a6405ca55977ea24b00422f
*/
add_action( 'init', function() {
// Remove the label.
remove_action( 'job_manager_job_filters_end', array( 'Listify_WP_Job_Manager_Template_Filters', 'job_types_label' ), 9 );