Static site generators.
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( 'gettext', 'maxpapi_translate_woocommerce_strings', 999, 3 ); | |
function maxpapi_translate_woocommerce_strings( $translated, $untranslated, $domain ) { | |
if ( ! is_admin() && 'woocommerce' === $domain ) { | |
switch ( $translated ) { | |
case 'Weight': | |
$translated = 'Shipping Weight'; | |
break; | |
case 'Dimensions': | |
$translated = 'Shipping Dimensions'; | |
break; |
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_available_payment_gateways', 'rudr_gateway_by_country' ); | |
function rudr_gateway_by_country( $gateways ) { | |
if( is_admin() ) { | |
return $gateways; | |
} | |
if( is_wc_endpoint_url( 'order-pay' ) ) { // Pay for order page |
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( 'allowed_block_types', 'misha_allowed_block_types', 10, 2 ); | |
function misha_allowed_block_types( $allowed_blocks, $post ) { | |
$allowed_blocks = array( | |
'core/image', | |
'core/paragraph', | |
'core/heading', | |
'core/list' | |
); |
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
//source: https://www.cloudways.com/blog/how-to-edit-delete-fields-and-email-in-woocommerce-custom-checkout-fields/ | |
//remove first name and last name. | |
function woocommerce_remove_additional_information_checkout($fields){ | |
unset( $fields["billing_first_name"] ); | |
unset( $fields["billing_last_name"] ); | |
return $fields; | |
} | |
add_filter( 'woocommerce_billing_fields', 'woocommerce_remove_additional_information_checkout' ); |
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
//difine default theme | |
define( 'WP_DEFAULT_THEME', 'default-theme-folder-name' ); | |
//diable autoupdate | |
define( 'AUTOMATIC_UPDATER_DISABLED', true ); | |
//only disable core updates | |
define( 'WP_AUTO_UPDATE_CORE', false ) | |
//enable trash for media |
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 Photographer Name and URL fields to media uploader | |
* | |
* @param $form_fields array, fields to include in attachment form | |
* @param $post object, attachment record in database | |
* @return $form_fields, modified form fields | |
*/ | |
function be_attachment_field_credit( $form_fields, $post ) { | |
$form_fields['be-photographer-name'] = array( |
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
register_post_type( 'custom_post_type_name', array( | |
'capability_type' => 'post', | |
'capabilities' => array( | |
'create_posts' => false, // Removes support for the "Add New" function ( use 'do_not_allow' instead of false for multisite set ups ) | |
), | |
'map_meta_cap' => true, // Set to `false`, if users are not allowed to edit/delete existing posts | |
)); |
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
<!-- Update woocommerce cart after quantity change without clicking the button --> | |
<style> | |
.woocommerce button[name="update_cart"], | |
.woocommerce input[name="update_cart"] { | |
display: none; | |
} | |
</style> | |
<script> |
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
//source: https://rudrastyh.com/wordpress/quick-edit-featured-image.html | |
/* | |
* This action hook allows to add a new empty column | |
*/ | |
add_filter('manage_post_posts_columns', 'misha_featured_image_column'); | |
function misha_featured_image_column( $column_array ) { | |
// I want to add my column at the beginning, so I use array_slice() | |
// in other cases $column_array['featured_image'] = 'Featured Image' will be enough |