tical' ); /** * Disable requests to wp.org repository for this theme. * * @since 1.0.1 * * @param array $request An array of HTTP request arguments. * @param string $url The request URL. * @return array Amended request arguments. */ function tripp_update_check( $request, $url ) { if ( false !== strpos( $url, '//api.wordpress.org/themes/update-check/1.1/' ) ) { $data = json_decode( $request['body']['themes'] ); $slug = get_template(); unset( $data->themes->$slug ); $request['body']['themes'] = wp_json_encode( $data ); } return $request; } add_filter( 'http_request_args', 'tripp_update_check', 5, 2 ); /** * Disables the Block Editor on Widgets Editing screen. */ add_filter( 'gutenberg_use_widgets_block_editor', '__return_false' ); add_filter( 'use_widgets_block_editor', '__return_false' ); /** * Tripp Theme actions & filters. */ /** * Filters the Custom Fonts available for this theme. * * @param array $fonts An array list of fonts available for this theme. * @return array An array list of fonts available for this theme. */ function tripp_custom_fonts( $fonts = array() ) { if ( function_exists( 'flextension_fonts' ) ) { $custom_fonts = flextension_fonts(); if ( ! empty( $custom_fonts ) ) { $fonts = array_merge( $fonts, $custom_fonts ); } } return $fonts; } add_filter( 'tripp_fonts', 'tripp_custom_fonts' ); /** * Sets the list of custom logo image attributes for the Light version. * * @param array $custom_logo_attr Custom logo image attributes. * @param int $custom_logo_id Custom logo attachment ID. * @return array Custom logo image attributes. */ function tripp_light_logo_image_attributes( $custom_logo_attr = array(), $custom_logo_id = 0 ) { $custom_logo_retina_id = absint( get_theme_mod( 'light_logo_retina', 0 ) ); if ( 0 !== $custom_logo_retina_id ) { $srcsets = array(); $srcsets[] = wp_get_attachment_image_url( $custom_logo_id, 'full' ) . ' 1x'; $srcsets[] = wp_get_attachment_image_url( $custom_logo_retina_id, 'full' ) . ' 2x'; $custom_logo_attr['srcset'] = implode( ', ', $srcsets ); } $custom_logo_attr['data-lazyload'] = 'disabled'; return $custom_logo_attr; } add_filter( 'tripp_get_light_logo_image_attributes', 'tripp_light_logo_image_attributes', 10, 2 ); /** * Adds a Dark Mode toggle button to the list of extra menu items. * * @param array $items An array of the extra menu items. * @return array An array of the extra menu items. */ function tripp_dark_mode_menu_button( $items = array() ) { // Only when the site allows users to change their preferences, or currently in Customize mode. if ( tripp_has_user_color_support() || is_customize_preview() ) { $items['dark-mode'] = ''; } return $items; } add_filter( 'tripp_extra_menu_items', 'tripp_dark_mode_menu_button' ); /** * Sets the author cover background image to the author's page header. * * @param array $args An array of the arguments for the header. * @return array An array of the arguments for the header. */ function tripp_author_page_header( $args = array() ) { if ( 'archive' === $args['layout'] ) { // Author page and Author Cover Image is available. if ( function_exists( 'flextension_author_cover_image_id' ) && is_author() && get_query_var( 'author' ) ) { $author_id = get_query_var( 'author' ); $image_id = flextension_author_cover_image_id( $author_id ); if ( $image_id > 0 ) { $image_url = wp_get_attachment_image_url( $image_id, 'fullwidth' ); if ( ! empty( $image_url ) ) { $args['background'] = 'image'; $args['background_image'] = $image_url; if ( function_exists( 'flextension_author_cover_image_styles' ) ) { $styles = flextension_author_cover_image_styles( $author_id ); if ( ! empty( $styles['background-position'] ) ) { $args['background_position'] = $styles['background-position']; } } } } } elseif ( function_exists( 'flextension_get_term_thumbnail_id' ) && ( is_category() || is_tag() || is_tax() ) ) { $term_id = get_queried_object_id(); $image_id = flextension_get_term_thumbnail_id( $term_id ); if ( $image_id > 0 ) { $image_url = wp_get_attachment_image_url( $image_id, 'fullwidth' ); if ( ! empty( $image_url ) ) { $args['background'] = 'image'; $args['background_image'] = $image_url; if ( function_exists( 'tripp_xt_term_image_styles' ) ) { $styles = tripp_xt_term_image_styles( $term_id ); if ( ! empty( $styles['background-position'] ) ) { $args['background_position'] = $styles['background-position']; } } } } } } return $args; } add_filter( 'tripp_page_header_args', 'tripp_author_page_header' ); /** * Filters the posts arguments for a search page. * * @param array $args An array of posts arguments. * @return array New array of posts arguments. */ function tripp_search_posts_args( $args ) { if ( is_search() || ( isset( $args['query'] ) && $args['query']->is_search() ) ) { $args['layout'] = 'search'; } return $args; } add_filter( 'tripp_posts_args', 'tripp_search_posts_args' ); /** * Adds the container (paragraph) the author description. * * @since 1.0.6 * * @param string $value The value of the metadata. * @return string The author description with the container. */ function tripp_add_author_description_container( $value = '' ) { if ( ! empty( $value ) ) { $value = '
'; } return $value; } add_filter( 'tripp_author_description', 'tripp_add_author_description_container', 10 ); /** * Inserts author location before the author description. * * @param string $value The value of the metadata. * @param int $user_id The user ID for the value. * @return string The author description with author location. */ function tripp_add_author_location( $value = '', $user_id = 0 ) { if ( function_exists( 'flextension_author_location' ) ) { $value = flextension_author_location( $user_id ) . $value; } return $value; } add_filter( 'tripp_author_description', 'tripp_add_author_location', 10, 2 ); /** * Adds the contact links to the author description. * * @param string $value The value of the metadata. * @param int $user_id The user ID for the value. * @return string The author description with the contact links. */ function tripp_add_author_social_links( $value = '', $user_id = 0 ) { if ( function_exists( 'flextension_get_user_social_links' ) ) { $value = $value . flextension_get_user_social_links( $user_id ); } return $value; } add_filter( 'tripp_author_description', 'tripp_add_author_social_links', 10, 2 ); /** * Prints out the filter options for the list of posts. * * @param array $options An array of options. */ function tripp_posts_filter_options( $options = array() ) { $taxonomies = get_object_taxonomies( $options['post_type'], 'objects' ); $taxonomies = wp_filter_object_list( $taxonomies, array( 'publicly_queryable' => true, ) ); /** * Filters the array list of taxonomies. * * @param array $taxonomies An array list of taxonomies. */ $taxonomies = apply_filters( 'tripp_posts_filter_taxonomies', $taxonomies ); if ( ! empty( $taxonomies ) ) { if ( ! empty( $options['taxonomy'] ) && isset( $taxonomies[ $options['taxonomy'] ] ) ) { unset( $taxonomies[ $options['taxonomy'] ] ); } if ( isset( $taxonomies['destination'] ) ) { unset( $taxonomies['destination'] ); } if ( ! is_search() ) { $taxonomies = wp_list_sort( $taxonomies, 'label' ); } $link_base = tripp_get_link_base(); $columns = 0; $output = ''; $selected_items = 0; foreach ( $taxonomies as $taxonomy ) { if ( empty( $taxonomy ) ) { continue; } $terms = get_terms( array( 'taxonomy' => $taxonomy->name, ) ); if ( is_wp_error( $terms ) ) { $terms = array(); } if ( ! empty( $terms ) ) { $columns++; $output .= '\s*
#', '', $content ); /** This filter is documented in wp-includes/post-template.php */ $content = apply_filters( 'the_content', $content ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound, WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedHooknameFound $content = trim( $content ); if ( ! empty( $content ) ) { echo '