0

I'm having some problems getting the WP Subtitle plugin to work.

After inserting the <?thesubtitle()?> or <?getthe_subtitle($id)?> into the index.php template I get a 'call to undefined function' error - inside or outside the loop doesn't seem to matter!

Thanks in advance

//Update

In most pages the following now works thanks to toscho's updated syntax

<?php get_header(); ?>

<div class="title-posts-container">
<h2 class="title-posts"><?php the_title(); ?></h2>
<p class="title-posts-strap"><?php the_subtitle(); ?></p>
</div>

<div class="content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

But no such joy in index.php where the following fails

<?php get_header(); ?>

<div class="title-posts-container">
<h2 class="title-posts"><?php the_title(); ?></h2>
<p class="title-posts-strap"><?php the_subtitle(); ?></p>
</div>

<div class="content">

<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
  • Inserting what? – fuxia Mar 12 '11 at 22:43
  • Ooops forgot to hit the code button around the php tags – toomanyairmiles Mar 12 '11 at 23:05
1

Try the correct syntax:

<?php the_subtitle(); ?>
<?php get_the_subtitle( $id ); ?>
  • Ok, this code doesn't produce an error - it simply does nothing. – toomanyairmiles Mar 13 '11 at 10:37
  • Well this is curious, it does work on normal pages and page templates but not in index.php?! – toomanyairmiles Mar 13 '11 at 11:21
  • Add a longer snippet to your original question demonstrating how exactly you use it in index.php. Outside of the loop it shouldn’t work if your index.php is an archive. – fuxia Mar 13 '11 at 16:33
  • @toomanyairmiles If your front page is an archive and not a static page, then there is not page to choose a subtitle from. What do you expect to see? – fuxia Mar 15 '11 at 18:48
  • The Homepage is static and the blog is using a News page to display posts - which is the code you're looking at the title and subtitle attributes are set in that page. – toomanyairmiles Mar 15 '11 at 21:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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