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
jQuery(document).ready(function(){ | |
// Ajax for make primary address -- my account page | |
jQuery(".class-name").click(function(){ | |
let class_id = $(this).attr('class-id'); | |
jQuery.ajax({ //ajax request | |
url: dsmAjax.ajaxurl, | |
type: "POST", | |
data: { | |
'action':'dsmGetCustomPostTypes', |
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
// ajax used in front end | |
add_action( 'init', 'dsm_script_enquer'); | |
function dsm_script_enquer() { | |
wp_register_script( "dsm_js_front", get_template_directory_uri().'/js/main.js', array('jquery') ); | |
wp_localize_script( 'dsm_js_front', 'dsmAjax', | |
array( | |
'ajaxurl' => admin_url( 'admin-ajax.php' ), | |
'ajax_nonce' => wp_create_nonce('ajax_csrf_check'), | |
)); | |
wp_enqueue_script( 'dsm_js_front' ); |
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
<header id="masthead" class="site-header"> | |
<div class="site-branding"> | |
<?php | |
the_custom_logo(); | |
if ( is_front_page() && is_home() ) : | |
?> | |
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1> | |
<?php | |
else : | |
?> |
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
if (isset($_GET['activated']) && is_admin()){ | |
$new_page_title = 'Parent Login'; | |
$new_page_content = ''; | |
$new_page_template = 'parent-login.php'; //ex. template-custom.php. Leave blank if you don't want a custom page template. | |
//don't change the code bellow, unless you know what you're doing | |
$page_check = get_page_by_title($new_page_title); | |
$new_page = 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
add_action( 'wp_login', 'track_user_logins', 10, 2 ); | |
function track_user_logins( $user_login, $user ){ | |
if( $login_amount = get_user_meta( $user->id, 'login_amount', true ) ){ | |
// They've Logged In Before, increment existing total by 1 | |
update_user_meta( $user->id, 'login_amount', ++$login_amount ); | |
} else { | |
// First Login, set it to 1 | |
update_user_meta( $user->id, 'login_amount', 1 ); | |
} | |
} |
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( 'get_user_option_admin_color', 'wpse_238039_set_admin_color' ); | |
function wpse_238039_set_admin_color() | |
{ | |
$current_user = wp_get_current_user(); | |
// Check for the user role | |
if ( user_can( $current_user, 'dsm_teacher' )) | |
{ | |
// Remove the Admin Color Scheme picker | |
remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' ); |
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_get_price_html', 'custom_price_html', 100, 2); | |
function custom_price_html($price, $product) | |
{ | |
// if (is_singular('product')) { | |
// return $price; | |
// } else { | |
if ($product->is_type('simple')) { | |
if ($product->is_on_sale()) { | |
$price = | |
' |