function magzimum_get_featured_content_details($input) { $featured_content_type = magzimum_get_option('featured_content_type'); switch ($featured_content_type) { case 'featured-category': $featured_content_number = magzimum_get_option('featured_content_number'); $featured_content_category = magzimum_get_option('featured_content_category'); $qargs = array('posts_per_page' => esc_attr($featured_content_number), 'no_found_rows' => true); if (absint($featured_content_category) > 0) { $qargs['category'] = esc_attr($featured_content_category); } // Fetch posts $all_posts = get_posts($qargs); $contents = array(); if (!empty($all_posts)) { $cnt = 0; foreach ($all_posts as $key => $post) { if (has_post_thumbnail($post->ID)) { $image_array = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'thumbnail'); if (!empty($image_array)) { $contents[$cnt]['images'] = $image_array; } } //end if $contents[$cnt]['title'] = esc_html($post->post_title); $contents[$cnt]['url'] = esc_url(get_permalink($post->ID)); $contents[$cnt]['date'] = get_the_time(get_option('date_format'), $post->ID); $contents[$cnt]['categories'] = magzimum_get_the_category_uno($post->ID); $cnt++; } } if (!empty($contents)) { $input = $contents; } break; default: break; } return $input; }
/** * Return one category link of a post. * * @since Magzimum 1.0 */ function magzimum_the_category_uno($id = '') { $output = magzimum_get_the_category_uno($id); echo $output; }