$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( 'business_aarambha_get_data_columns', $output ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Page Header
*
* @access public
* @return void
*/
public static function page_header() {
if ( is_page() ){
the_title('
', '
');
}
elseif ( is_404() ) {
echo '' . esc_html__( '404 Page','business-aarambha' ) . '
';
}
elseif ( is_single() ) {
the_title('', '
');
}
elseif ( is_home() ) {
echo '' . esc_html__( 'Blog','business-aarambha' ) . '
';
}
elseif( is_search() ) {
printf( '%s
', get_search_query() );
}
elseif( Business_Aarambha_Helper::is_woocommerce() && is_shop() ) {
echo '' . esc_html__( 'Shop','business-aarambha' ) . '
';
}
else {
the_archive_title( '', '
' );
}
}
/**
* Social Network Lists
*
* @access public
* @return array
*/
public static function social_network_list() {
return [
'facebook' => esc_html__( 'Facebook', 'business-aarambha' ),
'twitter' => esc_html__( 'Twitter', 'business-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( 'business_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(
'business_aarambha_post_meta_elements',
['author','date','comment']
);
// 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(
'business_aarambha_blog_pagination_type',
'nxt-prv'
);
if ( $pagination_type ) :
ob_start();
echo '';
$output = ob_get_clean();
echo apply_filters('business_aarambha_pagination_markup', $output); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
endif;
}
/**
* Author Box
*
* @return void
*/
public static function author_box() {
// Only display for standard posts
if ( 'post' != get_post_type() ) {
return;
}
// Get author data
$author = get_the_author();
$author_description = get_the_author_meta( 'description' );
$author_url = esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) );
$author_avatar = get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'business_aarambha_avatar_size', 150 ) );
$author_contents = ['name','info'];
?>
ID, [ 'fields' => 'ids' ] );
if ( ! empty( $cats ) ) {
$args['posts_per_page'] = 4;
$args['post__not_in'] = [ $current_post->ID ];
$args['category__in'] = $cats;
$args['no_found_rows'] = true;
$args['ignore_sticky_posts'] = true;
}
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) :
// Columns per row
$col_per_row = [
'desktop' => '2',
'tablet' => '2',
'mobile' => '1'
];
?>
>
have_posts() ) : $the_query->the_post();
/*
* Include the Post-Type-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Type name) and that will be used instead.
*/
?>
'button']
);
$enable_arrow = get_theme_mod(
'business_aarambha_blog_post_read_more_btn_arrow',
''
);
$read_more_class = ['read-more'];
if ( $btn_type && $btn_type['desktop'] == 'button' ) {
$read_more_class[] = 'read-more-button';
}
if ( $enable_arrow && array_key_exists( 'desktop' , $enable_arrow ) ) {
$read_more_class[] = 'd-flex align-items-center';
}
ob_start(); ?>
'button']
);
$enable_arrow = get_theme_mod(
'business_aarambha_banner_read_more_arrow',
''
);
$read_more_class = ['read-more'];
if ( $btn_type && $btn_type['desktop'] == 'button' ) {
$read_more_class[] = 'read-more-button';
}
if ( $enable_arrow && array_key_exists( 'desktop' , $enable_arrow ) ) {
$read_more_class[] = 'd-flex align-items-center';
}
ob_start(); ?>