badget

Biggest Sale! Special Offer!

Get 30% discount on all of our single themes with this coupon code: #30%SALE

Hurry up! *Limited time offer*

Reply To: How to change footer featured posts logic

#101741
gadgsphere
Participant

Hi,

I managed to do it editing php. If someone is trying also to manage this then you shoud go to theme files and footer.php.

In footer.php you will find section for footer posts. In code you can see comments that I added:
“Footer “You may missed” posts shows random posts from current week”

<?php
/**
 * The template for displaying the footer
 *
 * Contains the closing of the #content div and all content after.
 *
 * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
 *
 * @package NewsCard
 */

?>
		<?php global $newscard_settings; ?>
			</div><!-- row -->
		</div><!-- .container -->
	</div><!-- #content .site-content-->
	<footer id="colophon" class="site-footer" role="contentinfo">
		<?php if ( $newscard_settings['newscard_footer_featured_posts_hide'] === 0 ) {

			$footer_newscard_cat = absint($newscard_settings['newscard_footer_featured_post_categories']);
/**
 * Footer "You may missed" posts shows random posts from current week
 * added args are: 'orderby' => 'rand',
		   'year' => date( 'Y' ),
        	   'week' => strftime( '%U' )
*/
			$footer_post_type = array(
				'posts_per_page' => 4,
				'post__not_in' => get_option('sticky_posts'),
				'orderby' => 'rand',
				'year' => date( 'Y' ),
        		'week' => strftime( '%U' ),
				'post_type' => array(
					'post'
				),
			);
			if ( $newscard_settings['newscard_footer_featured_latest_post'] == 'category' ) {
				$footer_post_type['category__in'] = $footer_newscard_cat;
			}