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_shortcode('check_if_scraper_plugin_is_active', function() { | |
if(is_plugin_active('product-scraper/product-scraper.php')) { | |
return true; | |
} else { | |
return false; | |
} | |
}); |
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
// Make Custom Field Readonly | |
function make_price_field_readonly($field) { | |
$field['readonly'] = true; | |
return $field; | |
} | |
add_filter('acf/prepare_field/name=price_field_name', 'make_price_field_readonly'); |
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
// REMOVE TAB TITLES ON SINGLE PRODUCT TEMPLATE | |
// Remove Description Title from Single Product Page Tabs | |
add_filter('woocommerce_product_description_heading', '__return_null'); | |
// Remove Additional Information Title from Single Product Page Tabs | |
add_filter('woocommerce_product_additional_information_heading', '__return_null'); | |
// Remove Reviews Title from Single Product Page Tabs | |
add_filter('woocommerce_reviews_title', '__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
// Wordpress Default Font Sizes - Overriding them using theme.json is encouraged. | |
// See the theme.json to see how to override the default font size values in another gist | |
// Sizes in pixels | |
--wp--preset--font-size--small: 13px; | |
--wp--preset--font-size--medium: 20px; | |
--wp--preset--font-size--large: 36px; | |
--wp--preset--font-size--x-large: 42px; | |
// Sizes in rem | |
--wp--preset--font-size--small: 0.75rem; |
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
{ | |
"$schema": "https://schemas.wp.org/trunk/theme.json", | |
"version": 2, | |
"settings": { | |
"typography": { | |
"fontFamilies": [ | |
{ "fontFamily": "Rubik, sans-serif", "slug": "devforwp-rubik", "name": "DevForWp Rubik" } | |
], | |
"fontSizes": [ | |
{ "slug": "small", "size": "0.75rem", "name": "Small" }, |
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
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 = __( "Im Leoshop kaufen", "the7dt-child" ); | |
// Display button | |
echo '<a class="button" style="text-align: center; margin-bottom: 10px;" target="_blank" href="'.get_field('external_product_link', $product->get_id()).'">' . $button_text . '</a>'; | |
} |
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
add_filter( 'woocommerce_loop_add_to_cart_link', 'replace_add_to_cart_button_on_product_archive', 10, 2 ); | |
function replace_add_to_cart_button_on_product_archive($button, $product) { | |
$button_text = __("Show Product", "text_domain"); | |
$button = '<a class="button" href="' . $product->get_permalink() . '">' . $button_text . '</a>'; | |
return $button; | |
} |
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 | |
//It is not super complete but it is ok for the start | |
// Remember that $favicon_path will change according to your assets directory structure | |
function add_favicons() { | |
// declare the path variables | |
$favicon_path = get_template_directory_uri() . '/assets/img/favicon.ico'; | |
$apple_touch_icon_72x72_path = get_template_directory_uri() . '/assets/img/apple-touch-icon-72x72.png'; | |
$apple_touch_icon_114x114_path = get_template_directory_uri() . '/assets/img/apple-touch-icon-114x114.png'; | |
// echo to the wp_head anchor to append to it |
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 | |
// So-called menu is below and we will implement this custom menu by extending Walker_Nav_Menu class | |
/* | |
<ul> | |
<li class="active"><a href="index.html">Home</a></li> | |
<li class="drop-down"><a href="">About</a> | |
<ul> | |
<li><a href="about.html">About Us</a></li> | |
<li><a href="team.html">Team</a></li> | |
<li><a href="testimonials.html">Testimonials</a></li> |
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
// Here every then() method returns a new promise | |
// then() method always yields a promise after being executed, this way chaining is possible | |
// We can say here that every then() methods waits the previous promise to resolve | |
// Here the error handling is also easy. If any prior promise fails, catch() method will be triggered | |
fetch('https://api.openweathermap.org/data/2.5/weather?q=London,uk') | |
.then(response => { | |
return response.json(); | |
}) | |
.then(data => { | |
console.log(data); |