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( 'wp_nav_menu_items', 'custom_login_dashboard', 10, 2 ); | |
function custom_login_dashboard( $items, $args ) { | |
if (is_user_logged_in() && $args->primary-menu == 'primary') { //change your theme registered menu name to suit - currently for DIVI theme | |
$items .= '<li><a class="mydashboard" href="'. get_permalink( wc_get_page_id( 'myaccount' ) ) .'">My Dashboard</a></li>' . '<style> #top-header { background: #7a0101!important;} #main-header, #main-footer, #footer-bottom { background: black!important;}</style>'; | |
//the style is changing the theme's color once you are logged in | |
} | |
elseif (!is_user_logged_in() && $args->primary-menu == 'primary') {//change your theme registered menu name to suit | |
$items .= '<li><a class="mydashboard" href="' . get_permalink( wc_get_page_id( 'myaccount' ) ) . '">Log In</a></li>'; | |
} |
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
set {firstName, eAddress} to getData() | |
repeat with i from 1 to count firstName | |
tell application "Mail" | |
activate | |
set mymail to make new outgoing message at the beginning of outgoing messages with properties {subject:"Great new! We are now offering Radio Mobile Apps for Android and iOS here at Internet Radio Cast on VPS"} | |
tell mymail | |
make new to recipient at beginning of to recipients with properties {address:item i of eAddress} | |
delay 5 | |
set content to "Hi " & item i of firstName & " |
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
// change the “for” to "up to for" | |
function change_subscription_product_string( $subscription_string, $product, $include ) { | |
if( $include ){ | |
$subscription_string = str_replace('for', 'for up to', $subscription_string); | |
} | |
return $subscription_string; | |
} | |
add_filter( 'woocommerce_subscriptions_product_price_string', 'change_subscription_product_string', 10, 3 ); |
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
// Single script | |
function make_script_defer( $tag, $handle, $src ){ | |
if ( 'wp_register_script-name-1' != $handle ) { | |
return $tag; | |
} | |
return str_replace( '<script', '<script defer', $tag ); | |
} | |
add_filter( 'script_loader_tag', 'make_script_defer', 10, 3 ); | |
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
// class name example | |
jQuery( "#menu-item-30142 a" ).ready( function( $ ){ | |
$( "#menu-item-30142 a" ).addClass("class-name"); | |
}); | |
// #menu-item-30142 a is the element id with <a> tag |
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
// After login, users (customers and subscribers only) are redirected to the "Video Library" page -> get_permalink( $post = 6913 ); | |
function wc_custom_user_redirect( $redirect, $user ) { | |
// Get the first of all the roles assigned to the user | |
$role = $user->roles[0]; | |
$dashboard = admin_url(); | |
// video library URL | |
$videolibrary = get_permalink( $post = 6913 ); |
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
function excluding_blogs_header() { | |
// exclude from Posts Page (blog) page and all blog posts on the Main site (multisite) | |
if( !is_single() && !is_home() && 1 === get_current_blog_id() ) { | |
$code = "<script> Your script here </script>"; | |
} else { | |
$code = null; | |
} | |
echo $code; | |
} |
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
function custom_bxcft_birthdate_year($html, $type, $day, $month, $year, $field_id, $date) { | |
if($type == 'year'){ | |
$html = '<option value=""' . selected( $year, '', false ) . '>----</option>'; | |
for ( $i = date('Y', time()-60*60*24); $i > 1929; $i-- ) { | |
$html .= '<option value="' . $i .'"' . selected( $year, $i, false ) . '>' . $i . '</option>'; | |
} | |
} | |
return $html; |
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('learndash_course_completed', 'course_completed', 10, 1); | |
function course_completed( $data ) { | |
$course_id = $data['course']->ID; | |
$slug_url = get_post_field( 'post_name', $course_id ); | |
if ($course_id) { | |
// After creating a "congrats" parent page and a child page with the same slug from the course. | |
// More info here https://www.radiocastvps.com/how-to-redirect-to-a-page-after-completing-a-learndash-course/ | |
wp_redirect(site_url("/congrats/$slug_url")); |