post_parent ) && $image->post_parent != $id ) $url .= '#main'; return $url; } add_filter( 'attachment_link', 'accessiblezen_enhanced_image_navigation', 10, 2 ); if ( ! function_exists( 'accessiblezen_excerpt_length' ) ) : /** * Sets the post excerpt length to 100 words. * * To override this length in a child theme, remove the filter and add your own * function tied to the excerpt_length filter hook. * @since Accessible Zen 1.0 * @return integer. */ function accessiblezen_excerpt_length( $length ) { return 100; } add_filter( 'excerpt_length', 'accessiblezen_excerpt_length' ); endif; // accessiblezen_excerpt_length if ( ! function_exists( 'accessiblezen_continue_reading_link' ) ) : /** * Returns a "Continue Reading" link for excerpts. * @since Accessible Zen 1.0 * @return string with 'Continue reading' link. */ function accessiblezen_continue_reading_link() { return sprintf( '%2$s', esc_url( get_permalink( get_the_ID() ) ), /* translators: %s: Name of current post */ sprintf( esc_html__( 'Continue reading %s', 'accessible-zen' ), get_the_title( get_the_ID() ) ) ); } endif; // accessiblezen_continue_reading_link if ( ! function_exists( 'accessiblezen_auto_excerpt_more' ) && ! is_admin() ) : /** * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and accessiblezen_continue_reading_link(). * * To override this in a child theme, remove the filter and add your own * function tied to the excerpt_more filter hook. * @since Accessible Zen 1.0 * @return string 'Continue reading' link prepended with an ellipsis. */ function accessiblezen_auto_excerpt_more( $more ) { return ' … ' . accessiblezen_continue_reading_link(); } add_filter( 'excerpt_more', 'accessiblezen_auto_excerpt_more' ); endif; // accessiblezen_auto_excerpt_more /** * Return the URL for the first link found in the post content. * * @since Accessible Zen 1.0 * @return string|bool URL or false when no link is present. */ function accessiblezen_get_link_url() { if ( ! preg_match( '/]*?href=[\'"](.+?)[\'"]/is', get_the_content(), $matches ) ) return false; return esc_url_raw( $matches[1] ); }