display( 'Name', false, true );
$slug = preg_replace( "/[\s-]+/", " ", strtolower( hybridextend_trim( $name ) ) );
$slug = str_replace( " ", "-", $slug );
$link = ( empty( $link ) ) ? 'https://wordpress.org/themes/' . $slug : $link;
$anchor = ( empty( $anchor ) ) ? $name : $anchor;
$title = sprintf( __( '%s WordPress Theme', 'hybrid-core' ), $name );
return sprintf( '%s', esc_url( $link ), esc_attr( $title ), esc_html( $anchor ) );
}
/**
* Returns a link to the theme URI.
*
* @since 1.0.0
* @access public
* @param string $link
* @param string $anchor
* @return string
*/
function hybridextend_get_theme_link( $link = '', $anchor = '' ) {
/* Get Theme */
global $hybridextend_theme;
$name = $hybridextend_theme->display( 'Name', false, true );
$link = ( empty( $link ) ) ? $hybridextend_theme->get( 'ThemeURI' ) : $link;
$anchor = ( empty( $anchor ) ) ? $name : $anchor;
$title = sprintf( __( '%s WordPress Theme', 'hybrid-core' ), $name );
return sprintf( '%s', esc_url( $link ), esc_attr( $title ), esc_html( $anchor ) );
}
/**
* Filter the WordPress archive title after Hybrid has worked its magic
*
* @since 2.1.5
* @access public
* @param string $title
* @return string
*/
function hybridextend_loop_title( $title ) {
$title_suffix = '';
/* If the current page is a paged page. */
if ( ( ( $page = get_query_var( 'paged' ) ) || ( $page = get_query_var( 'page' ) ) ) && $page > 1 ) {
$paged = number_format_i18n( absint( $page ) );
$title_suffix = ' ' . sprintf( __( '(Page %s)', 'hybrid-core' ), $paged ) . '';
$title_suffix = apply_filters( 'hybridextend_title_suffix', $title_suffix, $paged );
}
return $title . $title_suffix;
}
add_filter( 'hybrid_archive_title', 'hybridextend_loop_title', 1, 3 );
/**
* Filter the WordPress archive description after Hybrid has worked its magic
*
* @since 2.1.5
* @access public
* @param string $title
* @return string
*/
function hybridextend_loop_description( $desc ) {
// @todo The following if statements should only be executed if none of the if statements in hybrid_archive_description_filter are true i.e. a continuation of elseif. Currently these ifs are run after the ifs in initial function. Hence we have removed 'is_archive' test. Note: encapsulating these in if(empty($desc)) wont work either. The only possible solution is redo all conditional statements.
if ( is_search() ) {
$search_query = get_search_query();
$desc = sprintf( __( 'You are browsing the search results for “%s”', 'hybrid-core' ), $search_query );
$desc = apply_filters( 'hybridextend_search_description', $desc, $search_query );
}
elseif ( is_time() )
$desc = __( 'You are browsing the site archives by time.', 'hybrid-core' );
elseif ( is_day() )
$desc = sprintf( __( 'You are browsing the site archives for %s.', 'hybrid-core' ), hybrid_get_single_day_title() );
elseif ( is_month() )
$desc = sprintf( __( 'You are browsing the site archives for %s.', 'hybrid-core' ), single_month_title( ' ', false ) );
elseif ( is_year() )
$desc = sprintf( __( 'You are browsing the site archives for %s.', 'hybrid-core' ), hybrid_get_single_year_title() );
// elseif ( is_archive() )
// $desc = __( 'You are browsing the site archives.', 'hybrid-core' );
return $desc;
}
add_filter( 'hybrid_archive_description', 'hybridextend_loop_description', 1 );