'page', 'posts_per_page' => 1, 'p' => $page_id, 'ignore_sticky_posts' => true, ); break; case 'post': $page_id = ! empty( $options['promotion_content_post'] ) ? $options['promotion_content_post'] : ''; $args = array( 'post_type' => 'post', 'p' => $page_id, 'posts_per_page' => 1, 'ignore_sticky_posts' => true, ); break; case 'custom': $page_post['title'] = isset($options['promotion_custom_title'])? $options['promotion_custom_title']: ''; $page_post['url'] = isset($options['promotion_us_btn_url']) ? $options['promotion_us_btn_url']: '#'; $page_post['image'] = !empty($options['promotion_custom_image']) ? $options['promotion_custom_image']: get_template_directory_uri() . '/assets/uploads/no-featured-image-600x450.jpg'; array_push( $content, $page_post ); return $content; default: break; } // Run The Loop. $query = new WP_Query( $args ); if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); $page_post['id'] = get_the_id(); $page_post['title'] = get_the_title(); $page_post['url'] = get_the_permalink(); $page_post['image'] = has_post_thumbnail() ? get_the_post_thumbnail_url( get_the_id(), 'large' ) : get_template_directory_uri().'/assets/uploads/no-featured-image-600x450.jpg'; // Push to the main array. array_push( $content, $page_post ); endwhile; endif; wp_reset_postdata(); if ( ! empty( $content ) ) { $input = $content; } return $input; } endif; // Promotion section content details. add_filter( 'blogmax_filter_promotion_section_details', 'blogmax_get_promotion_section_details' ); if ( ! function_exists( 'blogmax_render_promotion_section' ) ) : /** * Start Promotion section * * @return string Promotion content * @since Blogmax 1.0.0 * */ function blogmax_render_promotion_section( $content_details = array() ) { $options = blogmax_get_theme_options(); $btn_label = $options['promotion_read_more']; if ( empty( $content_details ) ) { return; } ?>