Now, we have created and stored the following options for our plugin:
Select whether to show posts and/or pages
Start the archive in collapsed mode
Set the year descriptions
We should now modify the plugin to make a good use of them.
To select whether we want to show post or pages, we will modify the display()
function.
Let's start by selecting whether to show posts and pages:
// the beginning of our output $result=' <div class="snazzy"> <table cellspacing="15" cellpadding="0" border="0"> <tbody> <tr>'; $options=$this->get_options(); //parse post options $types=array(); if ($options['posts']) array_push($types, "'post'"); if ($options['pages']) array_push($types, "'page'"); $types=implode(',', $types); // query to get all published posts $query="SELECT * FROM $wpdb->posts WHERE post_status = 'publish' AND post_password='' AND post_type IN ($types) ORDER BY post_date_gmt DESC "; $posts = $wpdb->get_results...