displaying classes from content within the loop (5 posts)

  1. Adriandc
    Posted 3 years ago #

    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;

    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

  2. Andrew Nevins
    Forum moderator
    Posted 3 years ago #

    You may need to use Custom Post Types, which will enable you to structure your table accordingly.

  3. Adriandc
    Posted 3 years ago #

    Thanks Andrew Ill have a read through that!

  4. Michael
    Forum Moderator
    Posted 3 years ago #


    echo apply_filters('the_content',$queried_post->post_content);


  5. Adriandc
    Posted 3 years ago #

    I think ill have to read about filters to see what I need to apply etc, because that didnt work on its own anyway, thanks though!

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.