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_filter( 'template_include', 'archives_overrides', 99 ); | |
function archives_overrides( $template ) { | |
global $post; | |
if(!$post){ return $template; } | |
if ( $post->ID == get_archive_for_projects() ) { | |
$new_template = locate_template( array( 'template-projects.php' ) ); | |
if ( '' != $new_template ) { return $new_template ; } | |
} |
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
<style> | |
input[type="file"]{ | |
position: absolute; | |
top: -500px; | |
} | |
div.file-listing{ | |
width: 200px; | |
} |
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 | |
//More: https://www.advancedcustomfields.com/resources/custom-location-rules/ | |
// fis to work on keys instead of IDS | |
// Filter for ACF create field panel | |
add_filter('acf/location/rule_values/page_type', 'acf_location_rules_values_page', 10); // filter location | |
function acf_location_rules_values_page( $choices ) { | |
$choices['archive_for_projects'] = __('Projects archive page', 'ustekveikja'); // value and select box text | |
$choices['archive_for_neighborhood'] = __('Neighborhood archive page', 'ustekveikja'); // value and select box text | |
return $choices; |
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 support to SVG in WP media viewer | |
*/ | |
function svg_meta_data_support($data, $id){ | |
$attachment = get_post($id); // Filter makes sure that the post is an attachment | |
$mime_type = $attachment->post_mime_type; // The attachment mime_type |
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 | |
// Hook up the AJAX actions | |
add_action( 'wp_ajax_nopriv_gf_button_get_form', 'gf_button_ajax_get_form' ); | |
add_action( 'wp_ajax_gf_button_get_form', 'gf_button_ajax_get_form' ); | |
function gf_button_ajax_get_form(){ | |
$form_id = isset( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0; | |
/* | |
used in case if you need additional dynamic fields |
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
"GB", "GIR[ ]?0AA|((AB|AL|B|BA|BB|BD|BH|BL|BN|BR|BS|BT|CA|CB|CF|CH|CM|CO|CR|CT|CV|CW|DA|DD|DE|DG|DH|DL|DN|DT|DY|E|EC|EH|EN|EX|FK|FY|G|GL|GY|GU|HA|HD|HG|HP|HR|HS|HU|HX|IG|IM|IP|IV|JE|KA|KT|KW|KY|L|LA|LD|LE|LL|LN|LS|LU|M|ME|MK|ML|N|NE|NG|NN|NP|NR|NW|OL|OX|PA|PE|PH|PL|PO|PR|RG|RH|RM|S|SA|SE|SG|SK|SL|SM|SN|SO|SP|SR|SS|ST|SW|SY|TA|TD|TF|TN|TQ|TR|TS|TW|UB|W|WA|WC|WD|WF|WN|WR|WS|WV|YO|ZE)(\d[\dA-Z]?[ ]?\d[ABD-HJLN-UW-Z]{2}))|BFPO[ ]?\d{1,4}" | |
"JE", "JE\d[\dA-Z]?[ ]?\d[ABD-HJLN-UW-Z]{2}" | |
"GG", "GY\d[\dA-Z]?[ ]?\d[ABD-HJLN-UW-Z]{2}" | |
"IM", "IM\d[\dA-Z]?[ ]?\d[ABD-HJLN-UW-Z]{2}" | |
"US", "\d{5}([ \-]\d{4})?" | |
"CA", "[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][ ]?\d[ABCEGHJ-NPRSTV-Z]\d" | |
"DE", "\d{5}" | |
"JP", "\d{3}-\d{4}" | |
"FR", "\d{2}[ ]?\d{3}" | |
"AU", "\d{4}" |
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']); |
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
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' ); |