views:

93

answers:

1

I have a wordpress-generated page where I need some posts (in a specific category) to have a 'Sign up' button. But when I add the conditioning code, found in this helpsheet, the page just shows this error:
'Parse error: syntax error, unexpected '<' in /home006/sub008/sc74101-DVGF/gadebold.dk/wp-content/themes/gadebold/single.php on line 9'

I'm placing the conditioning code in the loop (in single.php) like this:

if ( is_category('8') ) {
<div id="tilmeldknap">
<form method='post' action='<?php echo site_url('/events/tilmeld-hold/')?>'>
<input name="event" type="hidden" value="<?php echo the_title() ?>" />
<input type="submit" name="tilmeld" value="Tilmeld Hold" /></form></div>
<?php } else { ?>
<?php } ?>

starting with a php-tag ofc. since i couldn't get the code to show with it infront.

What am I doing wrong in this snippet?

+2  A: 

Change is_category to in_category. is_category means that you are on the category page for category 8, not that you are viewing a post that belongs to that category.

windyjonas
Oh, and change the first lines to:if ( is_category('8') ) {?><div id="tilmeldknap">
windyjonas
+1 for the comment, which addresses the error. Rest is bonus material.
Oddthinking
Thanks that seemed to do that trick
VoodooBurger