0

Live site.

I've got a custom theme that is giving me slight issues with shortcodes- they don't work. When I switched back to the default theme, the shortcodes worked fine. What do I need to look for in my custom theme to be the culprit?

If it matters, the shortcodes are for Contact Form 7 and Bookings plugins.

contact.php

<?php
/*
Template Name: Contact
*/
?>

<?php get_header(); ?>

<h2>Tell us, what's on your mind? Questions, comments, hellos- share them below.</h2>

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?> 



<?php get_footer(); ?>

Any and all help is greatly appreciated.

  • off my head is to make sure your theme has 'wp_head();` in header.php and wp_footer(); in footer.php – Bainternet Jul 7 '12 at 14:13
  • wp_head is just above the closing </head> in header.php and wp_footer is just after the opening <div id="footer"> in footer.php – user1255049 Jul 7 '12 at 14:20
  • Set WP_Debug to TRUE in wp-config and see if you get any errors. Then add those to your question. – mrwweb Jul 7 '12 at 15:18
  • debug shows no errors – user1255049 Jul 7 '12 at 15:27
  • 2
    is it particular page template? does it have the_content()? doesn't appear to be displaying any text.. can you show text other than the shortcode? do you have any improperly closed html in the html view? – helgatheviking Jul 7 '12 at 16:47
4

Your problem is the loop itself. As others suspected, you don't have the_content() to display the page content.

Change your loop to this and that should fix your problem:

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?> 
  • ah, i knew it had to be something simple i was overlooking. thank you. – user1255049 Jul 7 '12 at 19:05
  • yup, need the_content()!! glad you found the solution. – helgatheviking Jul 7 '12 at 19:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.