$taxonomies, 'hide_empty' => true, ) ); // Build the array. if ( $terms ) { foreach ( $terms as $term ) { $items[ $term->term_id ] = esc_html($term->name); } } return $items; } /** * Get an array of posts. * * @static * @access public * @param array $args Define arguments for the get_posts function. * @return array */ public static function get_posts( $args ) { if ( is_string( $args ) ) { $args = add_query_arg( array( 'suppress_filters' => false, ) ); } elseif ( is_array( $args ) && ! isset( $args['suppress_filters'] ) ) { $args['suppress_filters'] = false; } // Get the posts. // TODO: WordPress.VIP.RestrictedFunctions.get_posts_get_posts. $posts = get_posts( $args ); // Properly format the array. $items = array(); foreach ( $posts as $post ) { $items[ $post->ID ] = $post->post_title; } wp_reset_postdata(); return $items; } /** * Get data columns with values. * * @access public * @param array $values * @return void */ public static function get_data_columns( $values = [] ) { ob_start(); if ( ! empty( $values ) ) { // Base or Mobile echo isset( $values['mobile'] ) ? ' data-columns="' . esc_attr( $values['mobile'] ) .'"' : ( isset( $values['tablet'] ) ? ' data-columns="' . esc_attr( $values['tablet'] ) .'"' : ( isset( $values['desktop'] ) ? ' data-columns="' . esc_attr( $values['desktop'] ) .'"' : '' ) ); // Tablet echo isset( $values['tablet'] ) && isset( $values['mobile'] ) ? ' data-columns-md="' . esc_attr( $values['tablet'] ) .'"' : ( isset( $values['desktop'] ) && isset( $values['tablet'] ) ? ' data-columns-md="' . esc_attr( $values['desktop'] ) .'"' : '' ); // Desktop echo isset( $values['desktop'] ) && isset( $values['tablet'] ) && isset( $values['mobile'] ) ? ' data-columns-lg="' . esc_attr( $values['desktop'] ) .'"' : ''; } $output = ob_get_clean(); echo apply_filters( 'blogin_aarambha_get_data_columns', $output ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } /** * Archive Title * * @param $before string * @param $after string * @access public * @return void */ public static function archive_title( $before = '', $after = '' ) { if ( is_category() ) { $title = sprintf( __( ' %s', 'blogin-aarambha' ), '' . single_cat_title( '', false ) . '' ); } elseif ( is_tag() ) { $title = sprintf( __( ' %s', 'blogin-aarambha' ), '' . single_tag_title( '', false ) . '' ); } elseif ( is_author() ) { $title = sprintf( __( ' %s', 'blogin-aarambha' ), '' . get_the_author() . '' ); } elseif ( is_year() ) { $title = sprintf( __( ' %s', 'blogin-aarambha' ), '' . get_the_date( esc_html_x( 'Y', 'yearly archives date format', 'blogin-aarambha' ) ) . '' ); } elseif ( is_month() ) { $title = sprintf( __( ' %s', 'blogin-aarambha' ), '' . get_the_date( esc_html_x( 'F Y', 'monthly archives date format', 'blogin-aarambha' ) ) . '' ); } elseif ( is_day() ) { $title = sprintf( __( ' %s', 'blogin-aarambha' ), '' . get_the_date( esc_html_x( 'F j, Y', 'daily archives date format', 'blogin-aarambha' ) ) . '' ); } elseif ( is_tax( 'post_format' ) ) { if ( is_tax( 'post_format', 'post-format-aside' ) ) { $title = esc_html_x( 'Asides', 'post format archive title', 'blogin-aarambha' ); } elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) { $title = esc_html_x( 'Galleries', 'post format archive title', 'blogin-aarambha' ); } elseif ( is_tax( 'post_format', 'post-format-image' ) ) { $title = esc_html_x( 'Images', 'post format archive title', 'blogin-aarambha' ); } elseif ( is_tax( 'post_format', 'post-format-video' ) ) { $title = esc_html_x( 'Videos', 'post format archive title', 'blogin-aarambha' ); } elseif ( is_tax( 'post_format', 'post-format-quote' ) ) { $title = esc_html_x( 'Quotes', 'post format archive title', 'blogin-aarambha' ); } elseif ( is_tax( 'post_format', 'post-format-link' ) ) { $title = esc_html_x( 'Links', 'post format archive title', 'blogin-aarambha' ); } elseif ( is_tax( 'post_format', 'post-format-status' ) ) { $title = esc_html_x( 'Statuses', 'post format archive title', 'blogin-aarambha' ); } elseif ( is_tax( 'post_format', 'post-format-audio' ) ) { $title = esc_html_x( 'Audio', 'post format archive title', 'blogin-aarambha' ); } elseif ( is_tax( 'post_format', 'post-format-chat' ) ) { $title = esc_html_x( 'Chats', 'post format archive title', 'blogin-aarambha' ); } } elseif ( is_post_type_archive() ) { $title = post_type_archive_title( '', false ); } elseif ( is_tax() ) { $tax = get_taxonomy( get_queried_object()->taxonomy ); /* translators: 1: Taxonomy singular name, 2: Current taxonomy term */ $title = sprintf( esc_html__( '%1$s: %2$s', 'blogin-aarambha' ), $tax->labels->singular_name, '' . single_term_title( '', false ) . '' ); } elseif ( is_singular() ) { $title = get_the_title(); } elseif ( is_404() ) { $title = esc_html__( 'Error Page', 'blogin-aarambha' ); } elseif ( is_search() ) { $title = get_search_query(); } elseif ( Blogin_Aarambha_Helper::is_woocommerce() && is_shop() ) { $title = esc_html__( 'Shop', 'blogin-aarambha' ); } else { $title = esc_html__( 'Blog', 'blogin-aarambha' ); } /** * Filter the archive title. * * @param string $title Archive title to be displayed. */ $title = apply_filters( 'get_the_archive_title', $title ); if ( ! empty( $title ) ) { echo $before . $title . $after; // WPCS: XSS OK. } } /** * Social Network Lists * * @access public * @return array */ public static function social_network_list() { return [ 'facebook' => esc_html__( 'Facebook', 'blogin-aarambha' ), 'twitter' => esc_html__( 'Twitter', 'blogin-aarambha' ) ]; } /** * Retrieves the post meta. * * @param int $post_id The ID of the post. * @param null|array $meta_list custom post meta list * @return void */ public static function post_meta( $post_id = null, $meta_list = null ) { // Require post ID. if ( ! $post_id ) { return; } /** * Filters post types array. * * @param array Array of post types */ $disallowed_post_types = apply_filters( 'blogin_aarambha_disallowed_post_meta', array( 'page' ) ); // Check whether the post type is allowed to output post meta. if ( in_array( get_post_type( $post_id ), $disallowed_post_types, true ) ) { return; } $post_meta = $meta_list ? $meta_list : get_theme_mod( 'blogin_aarambha_meta_elements', ['categories','date'] ); // If the post meta setting has the value 'empty', it's explicitly empty and the default post meta shouldn't be output. if ( $post_meta && ! in_array( 'empty', $post_meta, true ) ) { // Make sure we don't output an empty container. $has_meta = false; global $post; $the_post = get_post( $post_id ); setup_postdata( $the_post ); ob_start(); ?>
max_num_pages < 2) { return; } $pagination_type = get_theme_mod( 'blogin_aarambha_blog_pagination_type', 'nxt-prv' ); if ( $pagination_type ) : ob_start(); echo '