Dear all:
First off - I am no expert in PHP, but have a working understanding of it, and a fairly good knowledge of HTML and CSS.
This said, I have been working to modify a plugin (specifically, Easy Digital Downloads) to provide front-end users a filter for downloads by one of the multiple category slugs I've tagged each download post with.
You can see an example of the working page here; after all, a picture is worth 1000 words:
http://kidzneurosciencecenter.com/bikesafe-materials/
EDD already limits the downloads that show up by the categories I pull with the shortcode, e.g., [downloads category="bikesafe,schools,parks"]
.
Problem is, each of the category navigation filters (All Files / BikeSafe / NULL - yes, I'm aware of the coding issue there) are generated by the CSS categories of each download; e.g., if one download reads <div class=BikeSafe Parks post-1923 EDD_downloads...
, then the categories "BikeSafe" and "Parks" are generated in the filter bar.
Problem is, I have yet to be able to write the PHP code that will emit the array of slugs unique to each individual download. This is a snippet of the code that writes the DIVs:
$downloads = new WP_Query( $query );
if ( $downloads->have_posts() ) :
$i = 1;
ob_start();?>
<div class="edd_downloads_list fusion-portfolio-wrapper<?php echo apply_filters( 'edd_downloads_list_wrapper_class', $wrapper_class, $atts ); ?>">
<?php while ( $downloads->have_posts() ) : $downloads->the_post(); ?>
<?php $schema = edd_add_schema_microdata() ? 'itemscope itemtype="http://schema.org/Product" ' : ''; ?>
<div <?php echo $schema; ?>class="<?php echo $terms[0]->slug; ?> fusion-portfolio-post <?php echo apply_filters( 'edd_download_class', 'edd_download', get_the_ID(), $atts, $i ); ?> post-<?php echo get_the_ID(); ?>" id="edd_download_<?php echo get_the_ID(); ?>" style="width: <?php echo $column_width; ?>; float: left;">
<?php echo sprintf( '<div class="edd_download_inner">' ); ?>
Obviously, the code that is spitting out the page simply writes "bikesafe" as one of the classes, and I did so simply so everyone here could see how I want it to work. However, I must have tried every single function I could locate online through the WP Codex and other sources, and I still can't get it to spit out the exact slug names per each unique download.
Anyone have some hints here? Tips? Suggestions? I've been at this for a week and a half now, and I'm aware that I've finally come to the point where I need to call the experts in before I get any more white hair.
If you need any extra code, just say the word. Tried to keep this post simple.
Thank you so much!
-Kurt