Skip to content

Instantly share code, notes, and snippets.

@mvital
mvital / set-featured-image.php
Created December 25, 2017 12:38 — forked from bueltge/set-featured-image.php
Set featureed image automaticly on save post/page
@mvital
mvital / Instructions: How to enqueue the CSS in your theme
Created January 31, 2019 09:23 — forked from gugaalves/custom-login-styles.css
WordPress - Customizing Login, Register and Lost Password pages
STEPS:
1 - If the theme was not developd by you, first create a child theme (How to create a child theme? Read at https://codex.wordpress.org/Child_Themes) or else modifications will be lost when updating your theme.
2 - Add the following CSS file in your theme/child theme (better if you create a folder to add CSS there).
3 - Add the following snippet in your functions.php file:
function tpw_enqueue_custom_admin_style() {
echo '<link rel="stylesheet" type="text/css" href="' . get_stylesheet_directory_uri() . '/css/admin/custom-login-styles.css" />';
}
@mvital
mvital / percentage_woocommerce_sale_flash.php
Created March 22, 2019 08:03 — forked from webdados/percentage_woocommerce_sale_flash.php
Discount percentage on the WooCommerce "on sale" badge
<?php
add_filter( 'woocommerce_sale_flash', 'percentage_woocommerce_sale_flash', 10, 3 );
function percentage_woocommerce_sale_flash( $html, $post, $product ) {
if ( $html!='' ) {
$perc = round( 100 - ( $product->sale_price * 100 / $product->regular_price ) );
if ( $perc>0 ) $html = '<span class="onsale">-'.$perc.'%</span>';
}
return $html;
}
/*
By oooh boi - Elementor Tips and Tricks
This will create "triangles" custom shape divider on the
right-hand side of the column (vertical), and then crete
another one (horizontal) for mobile devices.
*/
@media (min-width: 768px) {
selector:before {
content: "";
position: absolute;
{% if card_product.tags contains 'best-seller' %}
<span class="badge">Best Seller</span>
{% endif %}