This file contains 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
/** | |
* WordPress snippet | |
* Admin page redirection | |
* Put this inside theme setup function | |
*/ | |
global $pagenow; | |
if ( is_admin() && 'themes.php' == $pagenow && isset( $_GET['activated'] ) ) { |
This file contains 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
/** | |
* Source: http://justintadlock.com/archives/2013/10/07/post-relationships-parent-to-child | |
* Improved by Kharis Sulistiono | |
* Improvements: | |
* - Add "Select Relation" option | |
* - Add else conditional when no post created. | |
* | |
* To make that code works, make sure your post type supports custom meta box by adding 'register_meta_box_cb' | |
* | |
* From the code above, the CPT has to able to call a metabox callback function 'my_add_meta_boxes': |
This file contains 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
/** | |
* Do this in get_paypal_args method of class-wc-gateway-paypal.php | |
*/ | |
global $woocommerce; | |
$mailer = $woocommerce->mailer(); | |
$email = $mailer->emails['WC_Email_New_Order']; | |
$send_mail = $email->trigger( $order_id ); |
This file contains 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
// Asynchronous | |
var shirt, pants, shoes; | |
var getItem = function (storeName, itemName) { | |
var store = goToStore(storeName); | |
var item = store.getItem(itemName); | |
console.log('I got my ' + itemName); | |
return item; | |
}; |
This file contains 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
/* Samsung Galaxy S4 Landscape */ | |
@media screen (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) | |
and (device-width: 1920px) | |
and (orientation: landscape) { | |
/* Your styles here */ | |
} | |
/* Samsung Galaxy S4 Portrait */ | |
@media screen (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) | |
and (device-width: 1080px) |
This file contains 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
This is taken from my lecturer's (Bu Listyaning) slide presentation of PPL 1 class a few days ago. | |
The requirements of developing teaching media are: | |
* Visible | |
* Interesting | |
* Simple | |
* Useful | |
* Accurate | |
* Legitimate |
This file contains 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
// Query post | |
$args = array( | |
'post_type' => 'post', | |
'posts_per_page' => 10 | |
); | |
$posts = get_posts($args); | |
$count = 0; | |
$div_open = '<div class="every-two" style="background:#f7f7f7; padding: 5px; margin-bottom: 10px;">'; |
This file contains 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
/** | |
* Update the checkbox field whith this one | |
*/ | |
case 'checkbox': | |
$thepostid = empty( $thepostid ) ? $post->ID : $thepostid; | |
$field['class'] = isset( $field['class'] ) ? $field['class'] : 'checkbox'; | |
$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; | |
$field['value'] = isset( $options_data[0][$field_id] ) ? $options_data[0][$field_id] : ''; | |
$field['cbvalue'] = isset( $field['cbvalue'] ) ? $field['cbvalue'] : 'yes'; |
This file contains 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
$custom_product_data_fields[] = array( | |
'id' => '_mycheckbox', | |
'type' => 'checkbox', | |
'label' => __('Checkbox', 'wc_cpdf'), | |
'description' => __('Field description.', 'wc_cpdf'), | |
'desc_tip' => true, | |
'checked' => true, // Allows the checkbox to be checked by default. | |
); |
This file contains 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 | |
/** | |
* Cart Page | |
* | |
* @author WooThemes | |
* @package WooCommerce/Templates | |
* @version 2.3.0 | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { |
OlderNewer