# Skip Link URL

Hello Elementor Theme Basic

The theme has a "Skip to content" link at the top of the page, it's used by screen readers to quickly navigate to the main content area. Developers can modify the skip link URL using a filter hook in a child-theme.

# Hook Details

  • Hook Type: Filter Hook
  • Hook Name: hello_elementor_skip_link_url
  • Default Value: #content

The hook controls the URL of the main content on the page. By default it links to #content, i.e. an element with a content ID.

# Usage

To modify the skip link URL, use the following hook in a child-theme functions.php file:

function custom_hello_elementor_skip_link_url() {
	return '#main';
}
add_filter( 'hello_elementor_skip_link_url', 'custom_hello_elementor_skip_link_url' );
1
2
3
4

For conditional URLs based on WordPress Template Hierarchy (opens new window) use the following hook:

function custom_hello_elementor_skip_link_url() {
	if ( is_404() ) {
		return '#404-content';
	} else if ( is_page() ) {
		return '#page-content';
	} else if ( is_post() ) {
		return '#post-content';
	} else {
		return '#main-content';
	} 
}
add_filter( 'hello_elementor_skip_link_url', 'custom_hello_elementor_skip_link_url' );
1
2
3
4
5
6
7
8
9
10
11
12