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
/** | |
* filter translations, to replace some WooCommerce text with our own | |
* @param string $translation the translated text | |
* @param string $text the text before translation | |
* @param string $domain the gettext domain for translation | |
* @return string | |
*/ | |
function replace_some_woocommerce_text($translation, $text, $domain) { | |
switch ($text) { | |
case 'Direct bank transfer': |
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
$user = wp_get_current_user(); | |
$allowed_roles = array('shop_manager'); | |
if( array_intersect($allowed_roles, $user->roles ) ) { | |
//Load JavaScript for admin panel (wp-admin/backend) | |
add_action( 'admin_enqueue_scripts', 'hide_admin_menu_load_custom_script' ); | |
function hide_admin_menu_load_custom_script() { | |
wp_enqueue_script('custom_js', get_stylesheet_directory_uri() .'/js/custom.js', array('jquery')); | |
} |
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
//Load JavaScript file for front end from child theme | |
function my_scripts_method() { | |
wp_enqueue_script('custom-script', get_stylesheet_directory_uri() . '/js/custom-script.js', array( 'jquery' ) | |
); | |
} | |
add_action( 'wp_enqueue_scripts', 'my_scripts_method' ); |
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
//force the menu items to remain visible in the secondary header on mobiles using this CSS | |
//show top bar | |
@media (max-width: 980px) { | |
#top-header, div#et-secondary-menu, ul#et-secondary-nav { | |
display: block !important; | |
} | |
#top-header .container { | |
padding-top: 0.75em !important; | |
} | |
} |
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
//this issue occurs when using image uploaded SVGs | |
// Image widgets | |
function wp_get_attachment_metadata_mine($data) { | |
$res = $data; | |
if (!isset($data['width']) || !isset($data['height'])) { | |
$res = false; | |
} | |
return $res; |