Syntax Check
Posted: Thu Feb 11, 2010 1:45 am
Hello,
I need to place some code in a if else statement but the code I need to place in there has embedded <?php statements. Here's the if else statement:
Here's what I need to place in the else section:
Any help would be appreciated. Thanks.
I need to place some code in a if else statement but the code I need to place in there has embedded <?php statements. Here's the if else statement:
Code: Select all
<?php
if ( is_category() ) {
$cat = get_query_var('cat');
$child_cats = get_categories('child_of='.$cat);
if ($child_cats) {
$args = array(
'title_li' => '',
'echo' => 1,
'child_of' => $cat
);
wp_list_categories($args);
} else {
//do whatever if no child cats like do a post loop
}
}
?>
Code: Select all
<div class="middle">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<p><small><?php the_time('F jS, Y') ?> <?php the_author() ?></small> Posted in <?php the_category(', ') ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?> <?php edit_post_link('Edit', '', ' | '); ?> <?php if(function_exists('the_views')) { the_views(); } ?></p>
<div class="entry">
<?php the_content('Read the rest of this entry »'); ?>
</div>
<br />
<!-- AddThis Bookmark Post Button BEGIN -->
<?php echo "<div class=\"addthis\"><a href=\"http://www.addthis.com/bookmark.php?pub=blogohblog&url=".get_permalink()."&title=".get_the_title($id)."\" title=\"Bookmark using any bookmark manager!\" target=\"_blank\"><img src=\"http://s9.addthis.com/button1-bm.gif\" width=\"125\" height=\"16\" border=\"0\" alt=\"AddThis Social Bookmark Button\" /></a></div>"; ?>
<!-- AddThis Bookmark Post Button END -->