Support » Plugins » Alter my Dashboard Widget to Show Posts 60 days old

  • Equal Web Creative

    (@equalwebcreative)


    I currently have the following code in my functions.php file for my theme which is query posts and displaying them in a widget area on the dashboard:

    // Create the function to output the contents of our Dashboard Widget
    	function example_dashboard_widget_function() {
    		$drafts = new WP_Query("cat=-1&showposts=5&post_status=publish");
    		?>
            <ul>
    		<?php while($drafts->have_posts()) : $drafts->the_post(); ?>
    			<li><?php the_title(); ?> | <?php the_ID(); ?></li>
    		<?php endwhile; ?>
            </ul> <?php
    	}
    	// Create the function use in the action hook
    	function example_add_dashboard_widgets() {
    		wp_add_dashboard_widget('example_dashboard_widget', 'Example Dashboard Widget', 'example_dashboard_widget_function');
    	}
    	// Hook into the 'wp_dashboard_setup' action to register our other functions
    	add_action('wp_dashboard_setup', 'example_add_dashboard_widgets' );

    Could anybody suggest modification that I could make to this code so that aswell as excluding code that is in category 1, it also only shows posts that are 59 days old.

    Thanks in advance.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Alter my Dashboard Widget to Show Posts 60 days old’ is closed to new replies.