Skip to content

Instantly share code, notes, and snippets.

View turtlepod's full-sized avatar
🎧
Working from home

David Chandra Purnama turtlepod

🎧
Working from home
View GitHub Profile
@turtlepod
turtlepod / functions.php
Created August 20, 2016 05:12 — forked from tripflex/functions.php
Automatically set/assign parent taxonomy terms for hierarchical taxonomies in WordPress
<?php
add_action( 'set_object_terms', 'auto_set_parent_terms', 9999, 6 );
/**
* Automatically set/assign parent taxonomy terms to posts
*
* This function will automatically set parent taxonomy terms whenever terms are set on a post,
* with the option to configure specific post types, and/or taxonomies.
*
<?php
/**
* GitHub webhook handler template.
*
* @see https://developer.github.com/webhooks/
* @author Miloslav Hůla (https://github.com/milo)
*/
$hookSecret = 's.e.c.r.e.t'; # set NULL to disable check
.ion-alert-circled:before {
background-image: url( "data:image/svg+xml;charset=utf8,%3C%21--%20Generated%20by%20IcoMoon.io%20--%3E%0A%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2232%22%20height%3D%2232%22%20viewBox%3D%220%200%2032%2032%22%3E%0A%3Ctitle%3Eion-alert-circled%3C%2Ftitle%3E%0A%3Cpath%20d%3D%22M27.813%2026.375c0.188%200.313%200.313%200.813%200.125%201.125s-0.5%200.5-0.875%200.5h-26.125c-0.375%200-0.688-0.188-0.875-0.5s-0.063-0.813%200.125-1.125l12.938-21.813c0.188-0.313%200.5-0.563%200.875-0.563s0.688%200.25%200.875%200.563zM16%2025v-3h-4v3h4zM16%2020v-9h-4v9h4z%22%3E%3C%2Fpath%3E%0A%3C%2Fsvg%3E%0A" );
}
.ion-alert:before {
background-image: url( "data:image/svg+xml;charset=utf8,%3C%21--%20Generated%20by%20IcoMoon.io%20--%3E%0A%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228%22%20height%3D%2232%22%20viewBox%3D%220%200%208%2032%22%3E%0A%3Ctitle%3Eion-alert%3C%2Ftitle%3E%0A%3Cpath%20d%3D%22M8%2030h-
<?php
/**
* WC Meta Data ~ How to do this in WooCommerce 3 ?
*
* @link https://stackoverflow.com/questions/45540351/woocommerce-3-crud-how-to-do-this
*
* @link https://github.com/woocommerce/woocommerce/wiki/CRUD-Objects-in-3.0
*/
add_action( 'plugins_loaded', function() {
if ( ! class_exists( 'WooCommerce' ) ) {
@turtlepod
turtlepod / listing-labels.min.js
Created August 9, 2017 05:59
Listing Labels JS without History JS
/**
* Filter by labels.
*
* @since 2.0.0
*/
(function( window, undefined ) {
window.wp = window.wp || {};
var document = window.document;
@turtlepod
turtlepod / functions.php
Created August 23, 2017 03:43
Change Listify Map Marker Popup to Company Logo
<?php
// Change the data of a listing to add logo.
add_filter( 'listify_get_listing_to_array', function( $data, $listing ) {
$data['myLogoURL'] = esc_url( $listing->get_company_logo() );
return $data;
}, 10, 2 );
@turtlepod
turtlepod / functions.php
Created August 23, 2017 04:49
Listify: Display All Category (not nested) in single listing page
<?php
// Remove Category:
remove_action( 'single_job_listing_meta_start', 'listify_the_listing_category', 30 );
// Use Custom Category:
add_action( 'single_job_listing_meta_start', function() {
$cats = get_the_term_list(
get_post()->ID,
'job_listing_category',
'<span>',
@turtlepod
turtlepod / functions.php
Last active August 24, 2017 02:23
Add a button to the main single hero actions in Listify. Add 'button-secondary' class to change the color to the accent color.
<?php
/**
* Plugin Name: Listify - Custom Single Listing Hero Button
*/
function custom_listify_single_job_listing_actions_after() {
global $post;
// Get URL.
$url = get_post_meta( $post->ID, 'your_custom_meta_key', true );
@turtlepod
turtlepod / stuff.php
Created August 24, 2017 14:28
Google Maps API Key Test
<?php
/**
* Google API tester.
*/
function my_gmaps_key_test( $key ) {
$url = add_query_arg( $args = array(
'address' => 'Genbu Media',
), 'https://maps.googleapis.com/maps/api/geocode/json' );
@turtlepod
turtlepod / functions.php
Created September 12, 2017 02:01
Remove Rating Display if No Rating Exists Yet in Listify Theme.
<?php
/**
* Remove Rating Display if No Rating Exists Yet
*
* @link https://secure.helpscout.net/conversation/425117562/121662/
*/
add_action( 'init', function() {
// Remove Rating in Card if Empty.