• Resolved sheried

    (@sheried)


    Sorry if this is a newbee question – have searched internet and forums to no avail.

    For my homepage I want images instead of text summaries leading into a post. Seems easy enough – I put the code below into my page template and in the excerpt box I insert the code for the image which will be clicked to go to the post…

    <p class="post"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_excerpt(); ?></a></p>

    My problem is this:

    Th excerpt box automatically generates a <p> tag around the image code I insert. This is causing the page to fail validation as the output code results in

    <p class="post"><a href="https://www.linkaddress.co.uk/post1/" rel="bookmark"><strong><p></strong><img src="https://www.linkaddress.co.uk/wp-content/uploads/2010/01/testpost.jpg" alt="testpost" /><strong></p></strong> </a></p>

    … that extra p tag surrounding the image is not valid markup.

    I’ve tried adding a wysiwyg editor to the excerpt box (TinyMCE+advanced) to edit source code and remove the P tags – but upon saving they are automatically added again.

    Is there a way I can stop the excerpt box automatically enclosing the contents in a P tag?

    Any help much appreciated.

Viewing 1 replies (of 1 total)
  • Thread Starter sheried

    (@sheried)

    while helping someone out with their problem I found an acceptable workaround to mine. Instead of using the Excert box for the thumbnail lead in I am using a custom field and now it validates nicely…

    Just in case you need it here is what works (thumbnail image click to post)

    <div class="post"><a href="<?php the_permalink() ?>" rel="bookmark"><?php $values = get_post_custom_values("thumbnail-name"); echo $values[0]; ?></a></div>

Viewing 1 replies (of 1 total)
  • The topic ‘remove automatic formatting on Excerpt box’ is closed to new replies.