• Resolved sixfootjames

    (@sixfootjames)


    Hi,

    I am trying to use html tags within my loop like this:

    <?php query_posts('cat=5&posts_per_page=1');
    if (have_posts()) : while (have_posts()) : the_post();
    <strong>the_title();</strong>
    the_content();
    endwhile; endif;
    ?>

    Yet, I keep getting parse errors when I try and style the_title(); with a <strong> tag.

    I am using the Starkers theme which has this template code:

    <?php
    /**
     * Template Name: Home Page
     *
     * @package WordPress
     * @subpackage Starkers
     * @since Starkers HTML5 3.0
     */
    
    get_header(); ?>
    <?php get_template_part( 'loop', 'home' ); ?>
    <?php get_footer(); ?>

    this calls another php file called loop-home.php with the first snippet of code I added at the beginning.

    Many thanks!

    [Please post markup & code snippets between backticks or use the code button.]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter sixfootjames

    (@sixfootjames)

    It seems my above posted rendered the [strong] tags.

    essentially, what I need to do is wrap the_tile(); like this in my php

    [strong] the_tile();[/strong]

    <?php query_posts('cat=5&posts_per_page=1');
    if (have_posts()) : while (have_posts()) : the_post();?>
    <strong><?php the_title();?></strong>
    <?php the_content();
    endwhile; endif;
    ?>
    Thread Starter sixfootjames

    (@sixfootjames)

    Esmi…thank you so much! I will have to put in the effort to learn more about PHP when this project is complete.

    Much appreciated!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to use html tags within the loop’ is closed to new replies.