This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// register query_var on funtions.php | |
add_filter('query_vars', 'add_my_var'); | |
function add_my_var($public_query_vars) { | |
$public_query_vars[] = 'your_query_var'; | |
return $public_query_vars; | |
} | |
// get query var |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Modify which columns display in the admin views | |
add_filter('manage_edit-comments_columns', 'harisrozak_comments_add_columns'); | |
function harisrozak_comments_add_columns($columns) { | |
$columns['rating'] = "Rating"; | |
return $columns; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- On firefox, you must remove the tinymce on before modal close --> | |
<script type="text/javascript"> | |
var harisWpEditor; | |
;(function($) { | |
harisWpEditor = { | |
config: { | |
loadingTime: 350, | |
loadingText: 'Loading...' | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// set some checkout fields to empty | |
add_filter('woocommerce_checkout_get_value','woo_ongkir_checkout_get_value', 10, 2); | |
function woo_ongkir_checkout_get_value($default, $field) | |
{ | |
$empty_fields = array( | |
'billing_postcode', | |
'billing_state', | |
'billing_city', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// essentially disable WooCommerce's shipping rates cache | |
add_filter('woocommerce_checkout_update_order_review', 'clear_wc_shipping_rates_cache'); | |
function clear_wc_shipping_rates_cache(){ | |
$packages = WC()->cart->get_shipping_packages(); | |
foreach ($packages as $key => $value) { | |
$shipping_session = "shipping_for_package_$key"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
register_post_type( 'myplugin', | |
array( | |
'labels' => array( | |
'name' => 'My Plugin', | |
'all_items' => 'View All Rules', | |
'add_new' => 'Add Rule', | |
'add_new_item' => 'Add New Rule', | |
'edit' => 'Edit Rule', | |
'edit_item' => 'Edit Rule', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo a2enmod ssl | |
sudo mkdir /etc/apache2/ssl | |
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt | |
#enter you details | |
sudo service apache2 restart | |
sudo gedit /etc/hosts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function haris_lib__post_select($select_id, $post_type, $selected = 0, $limit = -1, $wc = false) | |
{ | |
$post_type_object = get_post_type_object($post_type); | |
$label = is_null($post_type_object) ? 'No data available' : 'Select ' . $post_type_object->label; | |
$posts = get_posts( | |
array( | |
'post_type'=> $post_type, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deny from all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
Google Map Script | |
https://developers.google.com/maps/documentation/javascript/reference#MapOptions | |
--> | |
<script src="https://maps.googleapis.com/maps/api/js?callback=initMap" async defer></script> | |
<script type="text/javascript"> | |
function initMap() { | |
var mapDiv = document.getElementById('google-map'); | |
var map = new google.maps.Map(mapDiv, { | |
center: {lat: 44.540, lng: -78.546}, |