Ask your WordPress questions! Pay money and get answers fast! (more info)

Validate this for me! WordPress

  • SOLVED

My Page: [[LINK href="http://themeforward.com/demo2/category/portfolio/"]]http://themeforward.com/demo2/category/portfolio/[[/LINK]]

Code causing errors:
<script type="text/javascript" charset="utf-8">
$(function(){
$("#portfolio_content").wrapInner("<table cellspacing='30'><tr>");
$(".portfolio_wrap").wrap("<td>");
});
</script>


My code:
<?php get_header(); ?>

<div id="portfolio_content">

<!-- Grab posts -->
<?php query_posts('cat=51&posts_per_page=1000&paged='.$paged);
if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>

<div class="portfolio_wrap">

<div class="img">
<a href="<?php the_permalink() ?>">
<?php $image = catch_that_image();
if( $image ) { ?>

<img src="<?php echo $image; ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>, <?php comments_number('No comments','One comment','% comments'); ?>" />

<?php } ?>

<span class="title"><?php the_title(); ?></span>
</a>

<div class="desc"><?php my_excerpt('short'); ?></div>

</div>
</div>

<?php endwhile; ?>

<?php endif; ?>

</div>
</div>

<?php get_footer(); ?>

Answers (1)

2011-03-09

Ivaylo Draganov answers:

Wrap it in CDATA tags to tell the validator to ignore the code:


<script type="text/javascript" charset="utf-8">
/* <![CDATA[ */
$(function(){
$("#portfolio_content").wrapInner("<table cellspacing='30'><tr>");
$(".portfolio_wrap").wrap("<td>");
});
/* ]]> */
</script>