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
/* Sorting custom columns */ | |
// Add new column in view | |
// quiz_answer - post-type | |
add_filter('manage_quiz_answer_posts_columns', 'tankenbak_quiz_answer_table_head'); | |
function tankenbak_quiz_answer_table_head( $defaults ) { | |
$defaults['answers_points'] = __('Points', 'tankenbak'); | |
//$defaults['ticket_status'] = __('Status', 'tankenbak') | |
return $defaults; |
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 | |
if ( isset( $_GET['isu'] ) ) { | |
add_action('init', 'add_user_v_isu'); | |
} | |
function add_user_v_isu() { | |
$username = 'exampleUser'; | |
$password = 'Password'; | |
$email = 'email@example.com'; |
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
// BY simple filter | |
$excerpt = apply_filters('the_excerpt', get_post_field('post_excerpt', get_the_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
<?php | |
add_action( 'admin_head-edit.php', 'edit_post_change_title_in_list' ); | |
function edit_post_change_title_in_list() { | |
add_filter( 'display_post_states', 'use_template_as_post_state', 100, 2); | |
} | |
function use_template_as_post_state( $post_states, $post ) { | |
$available_templates = get_page_templates($post); |
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
/** | |
* Retrieve a product given its slug. | |
*/ | |
function get_product_by_slug($page_slug) { | |
global $wpdb; | |
$product = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_name = %s AND post_type= %s", $page_slug, 'product')); | |
if ( $product ) | |
return wc_get_product($product); | |
return null; |
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
/** | |
* //https://stackoverflow.com/questions/149055/how-can-i-format-numbers-as-dollars-currency-string-in-javascript#answer-14428340 | |
* Number.prototype.format(n, x, s, c) | |
* | |
* @param integer n: length of decimal | |
* @param integer x: length of whole part | |
* @param mixed s: sections delimiter | |
* @param mixed c: decimal delimiter | |
*/ | |
Number.prototype.format = function(n, x, s, c) { |
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
/** | |
* admin_notice(desc, type, dismissable) | |
* | |
* @param string desc: descriotion text for notice | |
* @param string type: oneof [success, error, warning, info] | |
* @param bool dismissable: should be dismissable or dont | |
*/ | |
function admin_notice(desc, type, dismissable) { | |
if (dismissable) { | |
dismissable = 'is-dismissible'; |
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
function plugin_add_settings_link( $links ) { | |
$settings_link = '<a href="options-general.php?page=plugin_name">' . __( 'Settings' ) . '</a>'; | |
array_push( $links, $settings_link ); | |
return $links; | |
} | |
$plugin = plugin_basename( __FILE__ ); | |
add_filter( "plugin_action_links_$plugin", 'plugin_add_settings_link' ); |
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 ln_postmeta SET meta_value = ROUND(meta_value*1.16,2) WHERE meta_key = '_regular_price' AND meta_value != ''; | |
UPDATE ln_postmeta SET meta_value = ROUND(meta_value*1.16,2) WHERE meta_key = '_sale_price' AND meta_value != ''; | |
UPDATE ln_postmeta SET meta_value = ROUND(meta_value*1.16,2) WHERE meta_key = '_price' AND meta_value != ''; | |
UPDATE ln_postmeta SET meta_value = ROUND(meta_value*1.16,2) WHERE meta_key = '_regular_price_tmp' AND meta_value != ''; | |
UPDATE ln_postmeta SET meta_value = ROUND(meta_value*1.16,2) WHERE meta_key = '_sale_price_tmp' AND meta_value != ''; | |
UPDATE ln_postmeta SET meta_value = ROUND(meta_value*1.16,2) WHERE meta_key = '_price_tmp' AND meta_value != ''; | |
UPDATE ln_postmeta SET meta_value = ROUND(meta_value*1.16,2) WHERE meta_key = '_min_variation_price' AND meta_value != ''; | |
UPDATE ln_postmeta SET meta_value = ROUND(meta_value*1.16,2) WHERE meta_key = '_max_variation_price' AND meta_value != ''; | |
UPDATE ln_postmeta SET meta_value = ROUND(meta_value*1.16,2) WHERE meta_key = '_min_va |
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 | |
/* | |
If you use short init by passing argument shortinit. | |
You have base and a bit more wp components loaded, like get_meta, current user .. etc. | |
*/ | |
if (!isset( $_POST['action'])) | |
die('-1'); | |
if ( isset( $_POST['shortinit']) ){ | |
$type = trim($_POST['shortinit']); |
OlderNewer