%2$s'; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_string = ''; } $time_string = sprintf( $time_string, esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ), esc_attr( get_the_modified_date( 'c' ) ), esc_html( get_the_modified_date() ) ); $posted_on = sprintf( esc_html_x( 'Posted on %s', 'post date', 'business-trust' ), '' . $time_string . '' ); $byline = sprintf( esc_html_x( 'by %s', 'post author', 'business-trust' ), '' ); //escaped in line 27-35 echo '' . $posted_on . ''; } endif; if ( ! function_exists( 'business_trust_entry_footer' ) ) : /** * Prints HTML with meta information for the categories, tags and comments. */ function business_trust_entry_footer() { // Hide category and tag text for pages. if ( 'post' === get_post_type() ) { /* translators: used between list items, there is a space after the comma */ $categories_list = get_the_category_list( esc_html__( ', ', 'business-trust' ) ); if ( $categories_list && business_trust_categorized_blog() ) { printf( '' . esc_html__( 'Posted in %1$s', 'business-trust' ) . '', $categories_list ); } /* translators: used between list items, there is a space after the comma */ $tags_list = get_the_tag_list( '', esc_html__( ', ', 'business-trust' ) ); if ( $tags_list ) { printf( '', $tags_list ); } } if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo ''; /* translators: %s: post title */ comments_popup_link( sprintf( wp_kses( __( 'Leave a Comment on %s', 'business-trust' ), array( 'span' => array( 'class' => array() ) ) ), esc_html(get_the_title()) ) ); echo ''; } edit_post_link( sprintf( /* translators: %s: Name of current post */ esc_html__( 'Edit %s', 'business-trust' ), the_title( '"', '"', false ) ), '', '' ); } endif; /** * Returns true if a blog has more than 1 category. * * @return bool */ function business_trust_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'business_trust_categories' ) ) ) { // Create an array of all the categories that are attached to posts. $all_the_cool_cats = get_categories( array( 'fields' => 'ids', 'hide_empty' => 1, // We only need to know if there is more than one category. 'number' => 2, ) ); // Count the number of categories that are attached to the posts. $all_the_cool_cats = count( $all_the_cool_cats ); set_transient( 'business_trust_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 ) { // This blog has more than 1 category so business_trust_categorized_blog should return true. return true; } else { // This blog has only 1 category so business_trust_categorized_blog should return false. return false; } } /** * Flush out the transients used in business_trust_categorized_blog. */ function business_trust_category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } // Like, beat it. Dig? delete_transient( 'business_trust_categories' ); } add_action( 'edit_category', 'business_trust_category_transient_flusher' ); add_action( 'save_post', 'business_trust_category_transient_flusher' ); /* * check valid list item has been selected */ function business_trust_sanitize_select( $input, $setting ) { // Ensure input is a slug. $input = sanitize_key( $input ); // Get list of choices from the control associated with the setting. $choices = $setting->manager->get_control( $setting->id )->choices; // If the input is a valid key, return it; otherwise, return the default. return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } function business_trust_get_post_categories(){ $cats = get_categories(); $arr = array(); $arr[''] = '-- All --'; foreach($cats as $cat){ $arr[$cat->term_id] = $cat->name; } return $arr; } /** * Add cart to navigation menu */ function business_trust_add_search_form_to_menu($items, $args) { // If this isn't the main navbar menu, do nothing if( !($args->theme_location == 'primary') ) return $items; // On main menu: put styling around search and append it to the menu items global $woocommerce; return $items .'