Update: it was so yucky-looking that I dropped it before it even saw the light of day
So, in the event that the front page presents any confusion for readers (and I’m sure it might), I decided to reveal exactly which category each of the 4 featured areas (slider plus the 3 sub-features) belonged to…
This turned out to be a bit of a visual disaster.
I am definitely going to revisit this at some point in time… soon. The sooner the better. Because it’s looking mediocre at best. In the meantime, the code itself was simple enough that even a child could do it.
Looking again at the business.php page, I saw the following:
1 2 3 4 5 6 7 8 9 | <?php $glidecat = get_option('andro_gldcat'); $my_query = new WP_Query('category_name= '. $glidecat .'&showposts= 3'); while ($my_query->have_posts()) : $my_query->the_post();$do_not_duplicate = $post->ID; ?> |
This is the code that tells the server side which category the content should come from. The important bit was “get_option(‘andro_gldcat’);”, which I took immediately to mean, “grab the category set by the user in the Androida theme options”. All I had to do to use that code was recycle the variable name that’s already being set to that function, namely &glidecat.
Putting $glidecat a bit higher up and as a separate declaration, I can now use it twice. Once in an “introduction” phrase and once again to build the slider contents. The new code looks like this:
1 2 3 4 5 | <?php $glidecat = get_option('andro_gldcat'); ?> ... <div id="glidercontent" class="glidecontentwrapper"> <div id="togglebox" class="glidecontenttoggler"> <div class="feature_intro"><h3>The latest from “<?php echo $glidecat ?>”</h3></div> |
line 1 is the important one; 3 and 4 were already there; 5 is the new div with my “intro” line. Since most font treatments (resizing, positioning via margin/padding) was breaking the existing CSS, I just made the new div absolute. Here’s the CSS:
1 2 3 4 5 6 7 8 9 | .feature_intro{ position:absolute; left:35px; top:10px; } h3 { color: #EA7E3E; } |
And I used whatever the defaults are for h3 except for changing the colour. Not sure if the colour change was worth it… still looks wacky.
Moving on, since we’ve already declared the variable $glidecat, we don’t need to do it again. Just remove that line of code from the glider’s PHP function so that it now looks like:
1 2 3 4 | <?php $my_query = new WP_Query('category_name= '. $glidecat .'&showposts= 3'); while ($my_query->have_posts()) : $my_query->the_post();$do_not_duplicate = $post->ID; ?> |
That’s it.
Since you already get the concept of using Androida’s pre-existing variables, you can use this for the mini-categories as well. Just add a line like this:
1 | <h3>Latest in: <?php echo $minicat1;?></h3> |
Wherever you see fit. The variable names set by the Androida theme are quite obviously $minicat1, $minicat2, $minicat3.