WordPress.org

Ready to get started?Download WordPress

Forums

displaying classes from content within the loop (5 posts)

  1. Adriandc
    Member
    Posted 1 year 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;
    ?></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

  2. Andrew
    Forum Moderator
    Posted 1 year ago #

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

  3. Adriandc
    Member
    Posted 1 year ago #

    Thanks Andrew Ill have a read through that!

  4. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    try:

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

    http://codex.wordpress.org/Function_Reference/apply_filters

  5. Adriandc
    Member
    Posted 1 year 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

Tags

No tags yet.