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 | |
add_filter('ai1wm_exclude_content_from_export', function($exclude_filters) { | |
$exclude_filters[] = 'themes/your-theme-name'; | |
return $exclude_filters; | |
}); |
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 | |
// render elementor forms select item for year_built in Angebotsanfrage form | |
// rerender the select field using elementor form api | |
add_filter('elementor_pro/forms/render/item/select', function($item, $index, $form) { | |
if('vehicle_quote_form' === $form->get_settings_for_display('form_name') || 'vehicle_quote_form_popup' === $form->get_settings_for_display('form_name')) { | |
if('year_built' == $item['custom_id'] || 'year_built_popup' == $item['custom_id']) { | |
$item['field_options'] = "Bitte Jahr auswählen|\n"; | |
for($year=date('Y'); $year >= 1970; $year--) { | |
if($year != 1970) { | |
$item['field_options'] .= $year . "|" . $year . "\n"; |
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 | |
// FOR DEVELOPMENT PURPOSES, create a submenu page that displays the capabilities of | |
// Custom Post Type which is called Topic and this page is only available to ADMINS | |
add_action('admin_menu', 'mpons_forum_submenu'); | |
function mpons_forum_submenu() { | |
add_submenu_page( | |
'tools.php', | |
__('Media Pons Topic CPT', 'media-pons-forum'), | |
__('Media Pons Topic CPT', 'media-pons-forum'), |
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 | |
// Crocoblock Code Snippets | |
// Jet Smart Filters | |
// ----------------- | |
// Snippet No: 1 | |
// This code below sorts an array of filters that are related to a Custom Post Type | |
// Because Custom Post Type values are not coming in alphabetical order, this code is needed | |
// 601 is the Id of Jet Smart Filter Type | |
function theme_name_jet_filter_options( $options, $filter_id, $filter ){ |
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 | |
// Show price suffix only on single product page | |
add_filter( 'woocommerce_get_price_html', 'custom_price_suffix', 100, 2 ); | |
function custom_price_suffix( $price, $product ) { | |
if(is_singular('product')) { | |
$price = $price . ' <span class="mpons-price-suffix">Preis inkl. MwSt. & exkl. Versand</span>'; | |
} | |
return apply_filters( 'woocommerce_get_price', $price ); | |
} |
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 | |
// Add "Back to Shop" button on Single Product Template | |
// Sometimes it is useful a button to get back to Shop page | |
add_action('woocommerce_before_single_product', 'print_back_to_products_btn'); | |
function print_back_to_products_btn() { | |
$shop_page_url = get_permalink(woocommerce_get_page_id( 'shop' )); | |
echo '<a style="margin-bottom: 10px" class="button" href="' . $shop_page_url . '"><i class="fas fa-arrow-left"></i> All Products</a>'; | |
} |
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 | |
// Replace the Add to Cart Button on Single Product Template to go to a link that is also an ACF plugin URL field | |
add_action( 'woocommerce_single_product_summary', 'replace_single_add_to_cart_button', 1 ); | |
function custom_product_button(){ | |
$product = wc_get_product(); | |
// HERE your custom button text and link | |
$button_text = __( "Buy from external resource", "custom-textdomain" ); | |
// Display button |
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 | |
// Wooconmmerce - Change add to cart button to custom button on product archive page | |
add_filter( 'woocommerce_loop_add_to_cart_link', 'replacing_add_to_cart_button', 10, 2 ); | |
function replacing_add_to_cart_button( $button, $product ) { | |
$button_text = __("Produkt Details", "textdomain"); | |
$button = '<a class="button" href="' . $product->get_permalink() . '">' . $button_text . '</a>'; | |
return $button; | |
} |
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 | |
// Update the product skus with the number that is gathered from the Product Title. SKU is in parentheses | |
// Make it available as an admin page | |
function update_product_skus() { | |
$args = array( | |
'post_type' => 'product', | |
'posts_per_page' => -1, // Retrieve all products; adjust if needed | |
); |
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 | |
// Tweak the logout function to redirect to home page after logging out | |
add_action('wp_logout','auto_redirect_after_logout'); | |
function auto_redirect_after_logout(){ | |
wp_safe_redirect( home_url() ); | |
exit; | |
} |