WordPress.org

Support

Support » How-To and Troubleshooting » displaying classes from content within the loop

displaying classes from content within the loop

  • Adriandc

    @adriandc

    ust to explain briefly what Im trying to do, Im building a site for a local football team, on the homepage there are plans for a div with a league table on it, I want the user to able to easily adjust the league table by editing a single post. So far my code is this

    <div class="teaminfo"> <?php
    $post_id = 923;
    $queried_post = get_post($post_id);
    $title = $queried_post->post_title;
    echo $title;
    echo $queried_post->post_content;
    ?></div>

    But in my table i have a various classes applied to the rows, as I want borders and background colours. I assume that “post_content” is only going to pull literally the content , so im just wondering does anyone know any other way around this? I cant apply classes and divs in the code above because the same thing will be applied to ALL the content in one go if you get me.

    Thanks for the help

    EDIT: just adding one more thing, the reason Im not just giving the div a background of the colours I want and laying the content over it, is because the sites team will be highlighted a different colour so as they move up or down the table that colour will have to change

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘displaying classes from content within the loop’ is closed to new replies.