[resolved] How to use html tags within the loop (4 posts)

  1. sixfootjames
    Posted 3 years ago #


    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();
    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:

     * 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.]

  2. sixfootjames
    Posted 3 years ago #

    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]

  3. esmi
    Forum Moderator
    Posted 3 years ago #

    <?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;
  4. sixfootjames
    Posted 3 years ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Topic