WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: List category posts] Outputting in a Table (1 post)

  1. salisbury
    Member
    Posted 2 years ago #

    I am trying to use this plugin to produce a table of post titles and custom field values, using this shortcode:

    [catlist name="Aircraft Used" customfield_name="Operator" customfield_value="North Korean Air Force" customfield_name="End" customfield_value="current" customfield_display="Quantity,Active,Stored,Role" numberposts=-1 orderby=title order=asc template=inventory]

    And this is my template file (called inventory.php):

    /* This is the string which will gather all the information.*/
    $lcp_display_output = '';

    // Show category link:
    $lcp_display_output .= $this->get_category_link('strong');

    //Add 'starting' tag. Here, I'm using an unordered list (ul) as an example:
    $lcp_display_output .= '<table border=1 class="lcp_catlist"><tr><th class="types">Aircraft Type </th></tr>';

    /**
    * Posts loop.
    .....................
    */
    foreach ($this->catlist->get_categories_posts() as $single):
    //Start a List Item for each post:
    $lcp_display_output .= "<tr>";

    //Show the title and link to the post:
    $lcp_display_output .= $this->get_post_title($single, 'td', 'type');

    //Show comments:
    $lcp_display_output .= $this->get_comments($single);

    //Show date:
    $lcp_display_output .= ' ' . $this->get_date($single);

    //Show author
    $lcp_display_output .= $this->get_author($single);

    //Custom fields:
    $lcp_display_output .= $this->get_custom_fields($this->params['customfield_display'], $single->ID, 'td');

    //Post Thumbnail
    $lcp_display_output .= $this->get_thumbnail($single);

    /**
    * Post content - Example of how to use tag and class parameters:
    * This will produce:<p class="lcp_content">The content</p>
    */
    $lcp_display_output .= $this->get_content($single, 'p', 'lcp_content');

    /**
    * Post content - Example of how to use tag and class parameters:
    * This will produce:<div class="lcp_excerpt">The content</div>
    */
    $lcp_display_output .= $this->get_excerpt($single, 'div', 'lcp_excerpt');

    //Close li tag
    $lcp_display_output .= '</tr>';
    endforeach;

    $lcp_display_output .= '</table>';
    $this->lcp_output = $lcp_display_output;
    /

    The problem is that the output looks like this:

    Mil Mi-26 Halo Quantity : 20
    Active : 20
    Stored : 0
    Role : Transport

    The post title is in one table cell and all the custom fields are displayed in a single table cell. What I want is this:

    Mil Mi-26 Halo 20 20 0 Transport

    Where each custom field value is in its own table cell.

    Here is a hard-coded example of what I want it to look like
    http://www.aeroflight.co.uk/user/in-service/bahrain-af-current-inventory.htm

    How I get rid of the custom field names and put one custom field value in each table cell?

    Thanks for any help on this.

Topic Closed

This topic has been closed to new replies.

About this Topic