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
add_filter( 'acf/load_field/name=booking_calendar_feed_link', function ( $field ) { | |
$field['default_value'] = 'Default Value'; | |
$field['disabled'] = 1; | |
return $field; | |
} ); |
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
add_filter( 'woocommerce_package_rates', function ( $rates ) { | |
if ( isset( $_POST['post_data'] ) ) { | |
parse_str( $_POST['post_data'], $post_data ); | |
if ( isset( $post_data['billing_custom_field'] ) ) { | |
switch ( $post_data['billing_custom_field'] ) { | |
case 'Jeg_henter_selv': | |
unset( $rates['local_pickup:5'] ); | |
break; | |
case 'Levering_til_adresse': |
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
function remove_obj_filter_forcefully( $tag, $callback, $priority = 10 ) { | |
global $wp_filter; | |
$my_filter = $wp_filter[ $tag ]; | |
if ( isset( $my_filter ) ) { | |
$callbacks = $my_filter->callbacks; | |
if ( ! empty( $callbacks ) ) { | |
foreach ( (array) $callbacks[ $priority ] as $filter_callback ) { | |
if ( in_array( $callback, $filter_callback['function'] ) ) { | |
$my_filter->remove_filter( $tag, $filter_callback['function'], $priority ); |
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 | |
/** | |
* NOTE: This gist is very old. You might want to check out recent forks | |
* like this one: https://github.com/Alexlytle/Wordpress_custom_route/blob/main/Wordpress_Custom_route.php | |
* (thanks @Alexlytle) If you have an improvement to this gist, please | |
* post a link in a comment for others who might benefit. Thanks! | |
* | |
* A class to create simple custom routes. | |
* |
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
add_action( 'init', function () { | |
$trive_events = tribe( 'tec.iCal' ); | |
remove_action( 'tribe_events_single_event_after_the_content', [ $trive_events, 'single_event_links' ] ); | |
$trive_events_pro = Tribe__Events__Pro__Main::instance(); | |
remove_action( 'tribe_events_single_event_meta_primary_section_end', array( $trive_events_pro->single_event_meta, 'additional_fields' ) ); | |
} ); |
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
add_action( 'wp_footer', function () { | |
global $wp_filter; | |
echo '<pre style="background: #fff; color: #000; padding: 15px; text-align: left;">'; | |
var_dump($wp_filter); | |
echo '</pre>'; | |
} ); |
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
/* | |
* Relative Date. | |
*/ | |
function relative_date( $date, $type = 'string' ) { | |
$today_timestamp = strtotime( date( 'M j, Y' ) ); | |
$date_timestamp = strtotime( $date ); | |
$diff = ( $date_timestamp - $today_timestamp ) / 86400; | |
$html = ''; |
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
window.addEventListener("load", function(event) { | |
var mainSliderDOM = document.querySelector('.swiper-container.slider-main'); | |
if(mainSliderDOM) { | |
var mainSlider = mainSliderDOM.swiper; | |
mainSlider.allowTouchMove = false; | |
mainSlider.update(); | |
} | |
}); |
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
add_action( 'admin_head', function () { | |
global $pagenow; | |
if ( ! in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) { | |
return; | |
} | |
?> | |
<style> | |
.edit-post-visual-editor .wp-block.editor-post-title, | |
.edit-post-visual-editor .wp-block { | |
max-width: calc(100% - 100px); |
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
nav.woocommerce-MyAccount-navigation ul { | |
padding: 0; | |
margin: 0; | |
list-style: none; | |
} | |
nav.woocommerce-MyAccount-navigation ul li a { | |
display: block; | |
width: 100%; | |
padding: 12px 25px; |