Okay, I’ve hacked an ugly index.php that mostly does what I’m looking for, but there’s one little caviat: sometimes I need to have the download link be for a C file and sometimes for a CPP file.
Is there a way I can search the tags and if I see a CPP tag to change a variable?
Wanna see what I’ve got so far?
<?php get_header();?>
<?php $postnum = 1; $showadsense1 = 1;?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_date('','<h2>','</h2>'); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a>
<?php foreach((get_the_category()) as $cat) {
$cats = $cat->cat_name . ' '; if(strstr("$cats", "Programs") !== FALSE) {
if(function_exists('the_ratings')) {
/* Little PostRatings Mod */
/* Replaces all <div> tags with <span> tags to fix display problems on some themes */
ob_start();
the_ratings();
$remove_divs = ob_get_contents();
ob_end_clean();
echo str_replace('div', 'span', $remove_divs);
}
}
} ?>
</h3>
<div class="meta"><?php _e("Filed under:"); ?> <?php the_category(',') ?> — <?php the_tags(__('Tags: '), ', ', ' — '); ?> <?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(__('Edit This')); ?></div>
<div class="storycontent">
<?php if (is_single()) { ?>
<p align="center"><?php previous_post_link('« « %link', '%title', 'yes'); ?> | <?php next_post_link('%link » » ', '%title', 'yes'); } ?></p>
<?php foreach((get_the_category()) as $cat) {
$cats = $cat->cat_name . ' '; if(strstr("$cats", "Programs") !== FALSE) { ?>
<!-- Program posting template -->
<?php $proggy = strtolower(the_title('','',FALSE)); ?>
<p align="center"><a href="/pages/<?php _e($proggy); ?>/<?php _e($proggy); ?>.exe"><img src="/images/buttonexe.gif" alt="Download this program as a pre-compiled EXE for windows." /></a><a href="/pages/<?php _e($proggy); ?>/<?php _e($proggy); ?>.pdf"> <img src="/images/buttonpdf.gif" alt="Download the code in a formated PDF for print." /> </a><a href="/pages/<?php _e($proggy); ?>/<?php _e($proggy); ?>.c"><img src="/images/buttonc.gif" alt="Download the source code." /></a></p>
<p align="center"><a href="/pages/<?php _e($proggy); ?>/<?php _e($proggy); ?>.pdf"><img src="/pages/<?php _e($proggy); ?>/<?php _e($proggy); ?>thumb.gif" border="0" alt="<?php _e($proggy); ?>.C" /></a></p>
<?php }
} ?>
<?php the_content() ?>
<?php if (is_single()) { ?>
<p align="center"><?php previous_post_link('« « %link', '%title', 'yes'); ?> | <?php next_post_link('%link » » ', '%title', 'yes'); } ?></p>
</div>
<div class="feedback">
<?php wp_link_pages(); ?>
<?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
</div>
</div>
<?php comments_template(); // Get wp-comments.php template ?>
<?php if ($postnum == $showadsense1) { ?>
<p align="center">
<script type="text/javascript"><!--
google_ad_client = "pub-7691058508257211";
/* 468x60, created 4/29/08 */
google_ad_slot = "3195266714";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="https://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</p>
<?php } ?>
<?php $postnum++; ?>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
<?php posts_nav_link(' — ', __('« Newer Posts'), __('Older Posts »')); ?>
<?php get_footer(); ?>