I have the Download Monitor Plugin installed and it works beautifully, I just have a question regarding the categories.
I have a parent category, Issue 0, which will have anywhere from 3-6 sub categories in it. Instead of the section on the front page looking like below, where it just lists every download in the parent category regardless of sub categories,
How could I make it resemble the structure below, which actually uses the categories, where clicking on the sub category takes you to all of its downloads:
Issue 0 (7) >>
- News
- Diabetes
- Worldview
- interviews
( These needs to remain as links, like above)
Below is the code for the download_page shortcode, is there a way to incorporate the sub categories into this function?
function wp_dlmp_shortcode_download_page( $atts ) {
extract(shortcode_atts(array(
'base_heading_level' => '3',
'pop_count' => '4',
'pop_cat_count' => '4',
'show_uncategorized' => '1',
'per_page' => '20',
'format' => '',
'exclude' => '',
'exclude_cat' => '',
'show_tags' => '0',
'default_order' => 'title',
'front_order' => 'hits'
), $atts));
$output = wp_dlmp_output($base_heading_level, $pop_count, $pop_cat_count, $show_uncategorized, $per_page, $format, $exclude, $exclude_cat, $show_tags, $default_order, $front_order);
return $output;
}
add_shortcode('download_page', 'wp_dlmp_shortcode_download_page');
?>
From the documentation and its sample code, I cannot see an option to get the downloads categories tree.
The function
get_downloads
returns a one-dimensional array. Maybe a routine could be built to convert it into a multi-dimensional array.Use this to see its contents:
Another possibility is given by a global variable of the plugin that holds all the categories:
And the results are:
Using this array, a logic can be built to iterate through the elements and display the categories hierarchy.
Demonstration with a shortcode. Note that
digforcats
has to be a null value:Screenshots of the plugin page and the shortcode output:
There is very good documentation on the WP Download Monitor available at the author’s website. For what you’re trying to do you need to create a custom format following the examples provided.
Once you’ve created and saved the format you can specify the format to use in the shortcode or your php call.