Maybe this help you:
$ourposts = new WP_Query( $args );
// ask if there results
if( $ourposts->have_posts() ):
$i = 0;
// outside the while you open and close the tr so inside the while yo only have to print a close tr and reopen it
echo '<tr>';
while($ourposts->have_posts()) : $ourposts->the_post();
$i++;
// every three posts you closes and open a tr
if( $i%3==0 ){
echo '</tr><tr>';
}
echo '<td>'.get_the_title().'</td>';
endwhile;
// then close the tr
echo '</tr>';
endif;
Related Posts:
- Get Post Primary Category
- Custom post type permalink returns bad url
- Cant get paginations on single.php to work with my custom post types
- Displaying custom post types as a gallery
- Shortcode is displaying the content on top of the page [duplicate]
- Getting a Post ID to show its content in a Popup
- Add number in increment of one to DIV ID
- Add a background image into a post [closed]
- how to display custom taxonomies in front page
- xajax expanding list query
- How do I programmatically add items of content to a custom post type?
- Include images from pages in wp search.php results in default wp search
- Ajax filter with custom taxonomies
- List events by month
- Is it possible to insert text into an html tag using functions.php?
- Custom post type loops with different page templates
- How can I programmatically save data into custom fields that contain serialized data?
- Adding a span when custom post type is updated
- Row actions not showing? Why?
- Displaying custom post type on front page
- Custom Post Type .current-menu-item not applying on Custom Post Type Archive Page
- How to allow “Add New” capability of CPT when links to its UI are placed as a submenu?
- How to display a value from a radio button in the options menu in wordpress
- Dynamic Custom Post Type Plugin
- How to filter out post type meta?
- different template for first and second level custom post page
- Link users to a custom post type
- Weird problem happening with custom taxonmy when creating/updating posts
- A good strategy to print custom posts (offer) that are checked inside the metabox of a post?
- How to display Custom Post Type Post based on Tag with Shortcode Parameter?
- How to display selected taxonomies by their parent
- Custom Field Order by Last Name and First Name
- Get posts from a custom post type by child categories of a parent category
- Push metadata in array
- CPT + CMB2: data not displaying for only first post in loop
- Query & Order posts by custom fields
- ACF field key/value to show on taxonomy list
- Using custom field content as expression in IF statement [closed]
- How to Upload CSV Data into Custom Post Type Data with Metabox programmatically
- WordPress custom post type split into pages
- Assign External Database Queries to Global Variables and Make Them Accessible
- Different Category system needed for the Custom Post Type
- Specifying Mouseover Icon for Custom Post
- Custom post type causes php-error in php version 5.2.17
- Get data from PHP to JavaScript to set position of each post on front page
- Removing full title and breadcrumb header container for a specific post type
- When I choose category from dropdown then everything working fine.But in backend it checked only child not parent [closed]
- Query custom post types & Taxonomies and list them in a table on a page
- Creating a “glossary” of WordPress posts of a specific post type
- Using Pagination for Custom Post Type and keeps returning 404
- Nested Custom Taxonomies | Incorrect posts when querying
- Validate Custom Post Type fields
- meta query not retrieving posts
- How do I get the index for a custom post?
- Commas not displaying in implode
- add custom tags for custom post type in wordpress
- CPT Repeatable Fields + Undefined Index
- foreach loop inside the loop creating duplicates in output
- Function to erase every post from a taxonomy
- Custom Post Type Causes Error: Warning: call_user_func_array()
- Group episodes by seasons
- Is it a connection or relationship between 2 custom post types?
- redirect after submiting post for review
- CPT loop doesn’t seem to account for post date?
- Custom front-end form for adding post – Category problem
- Get only parent post in archive post
- update custom taxonomy custom fields
- Filter taxonomy by CPT
- Sort custom post column by generated value?
- WP Website is shown in HTML
- Custom post type order by post_title
- Tell wordpress to show a single page instead of an archive page
- Get meta values from parent post and save in child post
- PHP Notice: Unidentified index
- Add active class to foundation 6 tabs while looping categories
- Duplicate posts in my custom loop
- Include images from pages in wp search.php results in default wp search
- WordPress loop add heading before first of type
- get_post_meta for Custom Post Type ( CPT )
- WordPress query posts by custom post type not workng
- Where to find the html for WordPress site? [closed]
- How to display all custom fields associated with a post type – IN THE ADMIN AREA?
- Meta box not saving
- Featured image in custom post is being disabled
- Why is my custom post type slider only displaying the latest slide?
- Custom Search not working
- using ACF datepicker to filter posts on a page
- How Can I Center the Logo in the Navigation Menu? [closed]
- WordPress multi-query not returning as expected
- Custom Post-type not returning the right child_of
- WordPress Set A Static Page/Template For All Sub-Pages
- Add HTML before a specific div?
- How to hide home title on pages and posts?
- Woocommerce product page is not showing custom css [closed]
- Is there any way of not using my_init_method in the following code (that creates a custom post type)?
- Display ONLY ONE $term (Out of 4 terms) from a Custom Taxonomy and CPT
- Custom post type is_singular condtional not working when managing sidebar display
- Issue displaying multiple TinyMCE editors with WPAlchemy
- Option value not getting updated until page refresh in WordPress
- How to create a “Most Popular” & “Latest” TAB in WordPress