Support » Plugins » Highlight NEW pages and UPDATED pages in wp_list_pages

  • Hi,

    I am generating a list of pages using wp_list_pages. I would like to be able to automatically highlight NEW or RECENTLY UPDATED pages, perhaps by adding a new CSS class to them?

    I looked into using get_the_time but haven’t a clue how to integrate that with wp_list_pages.

    Any ideas or suggestions?

    Thanks in advance,

    Pete

Viewing 2 replies - 1 through 2 (of 2 total)
  • I am still struggling with this…

    I can achieve it outside of wp_list_pages using:

    <?php
    
    function skills_date_check() {
    	$postTime = get_the_modified_time("U");
        $currentTime = time();
        $timeDifference = $currentTime - $postTime;
    
        $minInSecs = 60;
        $hourInSecs = 3600;
        $dayInSecs = 86400;
        $monthInSecs = $dayInSecs * 31;
        $yearInSecs = $dayInSecs * 366;
    
        //if less than 3 months
    	if ($timeDifference < ($monthInSecs * 1)) {
    		$output = "<img class='new' src='http://skills.nclmedics.com/wp-content/themes/skillsmono/images/new.png'>";
    
        //if more than 3 months
    	} else if ($timeDifference > ($monthInSecs * 1)) {
    		$output = "";
    	} 
    
    	echo $output;
    
    	}
    
    ?>

    But i still need to highlight my menu items which are generated by wp_list_pages.

    Anyone??

    Pete

    You would need to create a filter/hook for the wp_list_pages function, and then modify it’s output.

    Contact me on Twitter if you’re still trying to do this…

    @acedrew

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Highlight NEW pages and UPDATED pages in wp_list_pages’ is closed to new replies.