Vajna Botond

Online Portofolio

Show which template is used

function meks_which_template_is_loaded() {
   if ( is_super_admin() ) {
       global $template;
       print_r( $template );
   }
}
add_action( 'wp_footer', 'meks_which_template_is_loaded' );

Remove -scaled image

add_filter( 'wp_generate_attachment_metadata', 'delete_fullsize_image' );
function delete_fullsize_image( $metadata ) {

    $upload_dir = wp_upload_dir();
    $full_image_path = trailingslashit( $upload_dir['basedir'] ) . $metadata['file'];
    $deleted = unlink( $full_image_path );

    return $metadata;
}

WordPress image sizes

WordPress automatically generate some images on upload so when you upload one image by default there will be 5, or more variants of the same image with different sizes. You may not need all these image sizes, an they are just using space on the server. this can be annoying if you are short on… Read More ›

How to add read more link to your WordPress excerpt?

By default WordPress function the_excerpt(); does not display a read more link.
To display link to post after the excerpt you must filter the excerpt_more.

Auto format text

wpautop(); replace double line breaks with HTML paragraph tags. source: https://developer.wordpress.org/reference/functions/wpautop/

Create WordPress custom hooks

When I create custom WordPress themes speed is a must. thaht`s one thing why you need custom themes, ready made themes have a lots of code you do not need in your site, and they are just slowing down your page load. For instance by avoiding the use of wp_head(); or/and wp_footer(); you can significantly… Read More ›

CSS background opacity with rgba in IE 8

RGBA background in IE. does not work, but you can use a gradient filter, with the same start and end color as in the example below

Get woocommerce product gallery images

source:https://gist.github.com/Niloys7/17b88d36c1c38844a6cf2127c15dee63

Custom block editor styles

Create files in wp theme editor

In WP theme editor open functions.php, and add the following code and replace my-file.php with your file name. source:https://chap.website/creating-new-files-in-the-wordpress-theme-editor/

How to get WooCommerce products grouped by their categories?

How to get WooCommerce products grouped by their categories? https://www.themelocation.com/how-to-get-woocommerce-products-grouped-by-their-categories/

Enable Gutenberg editor in WooCommerce

https://dev.to/kalimahapps/enable-gutenberg-editor-in-woocommerce-466m

Woocommerce product gallery opacity issue

Woocommerce product gallery opacity issue Issue: In single-product.php when using the_content(); the woocommerce-product-gallery div have the opacity set to: 0. Solving: use wp_head(); in the header.php and wp_footer(); in the footer.php add the following code to functions.php: reference: https://yootheme.com/support/question/109928

netflix-codes

How to use the Netflix codes To visit each genre’s webpage, at the end of the URL: http://www.netflix.com/browse/genre/ add the code you want from the list below: Asian Action Movies (77232) Classic Action & Adventure (46576) Action Comedies (43040) Action Thrillers (43048) Adventures (7442) Comic Book and Superhero Movies (10118) Westerns (7700) Spy Action & Adventure… Read More ›