Skip to content

Instantly share code, notes, and snippets.

View rotisoft's full-sized avatar

Tamas "RotiSoft" Rottenbacher rotisoft

View GitHub Profile
/**
* Add that code to your theme functions.php file. Choose or modify which file/mime type need and delete the others.
* Replace the file type. More info: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
* Gist by Tamas Rottenbacher
* Source: https://wpsmackdown.com/add-remove-filetypes-wordpress-media-library/
*/
function disable_mime_types($mime_types){
unset($mime_types['bmp']); // Disable .bmp file upload
unset($mime_types['tiff']); // Disable .tiff file upload
return $mime_types;
/**
* Add that code to your theme functions.php file. Choose or modify which file/mime type need and delete the others.
* Replace the file type. More info: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
* Gist by Tamas Rottenbacher
* Source: https://wpsmackdown.com/add-remove-filetypes-wordpress-media-library/
*/
function approve_mime_types($mime_types){
$mime_types['rar'] = 'application/x-rar-compressed'; // Approve .rar file upload
$mime_types['bmp'] = 'image/bmp'; // Approve .bmp image upload
$mime_types['svg'] = 'image/svg+xml'; // Approve .svg image upload
<?php
/*
* Plugin Name: Pont shipping for Woocommerce - Add custom Prefix
* Plugin URI: https://rotisoft.hu/bovitmenyek/
* Description: Szathmari Andor WC-PONT Sprinter rendszernel elotag hozzadasa, hogy SprinterPartnerPortalon egyes webshopok rendelesei elkulonithetoek legyenek.
* Version: 1.0
* Author: Rottenbacher RotiSoft Tamas
* Author URI: https://rotisoft.hu/
*
* Requires at least: 5.7
# Block WordPress xmlrpc.php requests
<Files xmlrpc.php>
order deny,allow
deny from all
</Files>
@rotisoft
rotisoft / php.ini
Last active June 20, 2021 08:24
WordPress honlap alap/ajánlott PHP értékek megadása.
max_execution_time = 180
max_input_time = 300
max_input_vars = 10000
memory_limit = 256M
upload_max_filesize = 128MB
post_max_size = 128M
@rotisoft
rotisoft / .htaccess
Last active August 28, 2021 10:09
WordPress honlaphoz ajánlott PHP értékek megadása, .htaccess fájl segítségével.
php_value upload_max_filesize 128M
php_value post_max_size 128M
php_value max_execution_time 180
php_value max_input_time 300
php_value memory_limit 256M
php_value max_input_vars 10000
/**
* Add that code to your WordPress site wp-config.php file.
* Replace the domain.tld to your site domain.
* Don't forget the https.
* Gist by Tamas Rottenbacher
* Source: https://wordpress.org/support/article/changing-the-site-url/
*/
define( 'WP_HOME', 'https://example.com' );
define( 'WP_SITEURL', 'https://example.com' );
@rotisoft
rotisoft / wordpress-webp-upload.php
Last active March 30, 2021 22:26
WordPress WebP upload / feltoltes
/**
* Sets the extension and mime type for .webp files.
* @param array $wp_check_filetype_and_ext File data array containing 'ext', 'type', and * 'proper_filename' keys.
* @param string $file Full path to the file.
* @param string $filename The name of the file (may differ from $file due to
* $file being in a tmp directory).
* @param array $mimes Key is the file extension with value as the mime type.
*/
add_filter( 'wp_check_filetype_and_ext', 'wpse_file_and_ext_webp', 10, 4 );
DELETE relations.*, taxes.*, terms.*
FROM wp_term_relationships AS relations
INNER JOIN wp_term_taxonomy AS taxes
ON relations.term_taxonomy_id=taxes.term_taxonomy_id
INNER JOIN wp_terms AS terms
ON taxes.term_id=terms.term_id
WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type='product');
DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type = 'product');
DELETE FROM wp_posts WHERE post_type = 'product';
@rotisoft
rotisoft / gist:8a33fcb56a6faa78b9274b83a4949328
Created August 14, 2018 18:08
Woocommerce - Add sub categories list after description
add_action( 'woocommerce_archive_description', 'rs_woo_category_description' );
function rs_woo_category_description() {
$parentid = get_queried_object_id();
$args = array( 'parent' => $parentid);
$terms = get_terms( 'product_cat', $args );
if ( $terms ) {
echo '<hr>';
echo '<div class="rssubcategories">';
echo '<h2>Alkategóriák</h2>';