Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using this code to display a page within my front page. I would like to learn how to add a div / spacer to isolate the page title... If I try to add a div class within the php code then it throws errors.

Question: How can I add a div to the title within this bit of code?

<div class="frontpage">
<?php 
$page_id = 2945; 
$page_data = get_page( $page_id ); 
echo '<h3>'. $page_data->post_title .'</h3>'; //enclose the title within a div/spacer???
echo apply_filters('the_content', $page_data->post_content);
?>

Thanks

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Try to change heading from

echo '<h3>'. $page_data->post_title .'</h3>';

like

echo '<div class="class-name">'. $page_data->post_title .'</div>';
share|improve this answer
    
Thanks Sebastian - you must have posted that just as I was adding my answer - Thankyou :-) –  speedypancake Nov 26 '12 at 9:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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