Browse: Home / Snippets /

Change Focus Mode Course Home menu link url

Contents


Snippet #

add_action( 'wp_footer', function() {
	$focus_mode_post_types = array(
		'sfwd-lessons',
		'sfwd-topic',
		'sfwd-assignment',
		'sfwd-quiz',
	);
	
	if ( is_singular( $focus_mode_post_types ) ) :
	?>
		<script>
			const courseHomeLink = document.querySelector( '.ld-user-menu-items > a:first-child' );
			
			// Just in case they're not really in Focus Mode
			if ( courseHomeLink ) {
				courseHomeLink.setAttribute( 'href', 'https://example.com' );
			}
		</script>
	<?php
	endif;
} );