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
- How do you output custom code between posts in the loop?
- Show ACF field from custom taxonomy and display on the single template
- How to allow “Add New” capability of CPT when links to its UI are placed as a submenu?
- Change message given when deleting post from custom post type
- Display children and grandchildren of a custom post type
- How to append element after thumbnail
- wordpress custom post type remove duplicate menu item
- Using WPAlchemy metabox values in another metabox
- Minify HTML, CSS, JS with PHPWee?
- is_page_template not working as expected
- List terms from Custom Taxonomy
- WP_Query search posts by custom post type and custom taxonomy
- How to display a value from a radio button in the options menu in wordpress
- Dynamic Custom Post Type Plugin
- Order WordPress Custom Taxonomy Pages & Pagination Not Working
- I am having a problem with form updating/editing WordPress post on the frontend
- How to filter out post type meta?
- How to make in WordPress admin panel sortable column for the custom field, that count the number of page impressions?
- Add the current menu item CSS class to a custom page type archive in WordPress menu
- Display custom field of specific post where post title matches variable
- Conditional to modify query results
- Loop through posts of a custom-post-type (event) and create .ics (iCal) file?
- different template for first and second level custom post page
- How can I change the title of an Add New page in Admin for custom post type
- Output custom post shortcode. Help spot the error.
- How to count custom post types with conditional operators
- Change post featured image on hover
- WP_Query is printing out only one post when posts_per_page is set to multiple
- WP Query to displaying date and posts for that date?
- GravityForm: Populate Dropdown with custom post type [closed]
- Return array of categories to php function for current post
- Link users to a custom post type
- Create a random unique 6 digit number as custom field for custom post type
- How to output wordpress custom tags separated by comma?
- Loading all files within a directory
- Blog page showing same content as homepage
- Custom Post Type Taxonomies -Posts not showing in Category or Tag pages
- Custom post type and body_class: Remove “blog” class
- Using several custom fields as custom post title
- Custom Post Type without an archive page
- Get rewrite slug of custom post type in template
- Show Different Header on a Specific Post ID
- Shortcode content output but not in correct place
- 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?
- An unwanted inline style is added to my body tag
- Admin notice not displaying
- Can’t get order_by meta_value_num to work properly
- Show post in slider
- Create custom post type on successful woocommerce order [closed]
- Adding custom tables to WordPress
- Taxonomy Archive: Display only one post per term from separate custom taxonomy
- How can I hide Home in my menu in a specific page?
- Very Slow Page – How to Optimize # of Queries?
- Dynamic page outside WordPress
- Missing sidebar parameter “fix” – before_content
- Using wordpress template tags within an array
- How to display Custom Post Type Post based on Tag with Shortcode Parameter?
- Getting the URL of the parent page
- Custom query to filter posts that have current post as a taxonomy [closed]
- How Display Posts on category
- Return the thumbnail meta data for getter and setter
- Is possible add class for last post of Custom Post Type?
- How to display selected taxonomies by their parent
- Custom Field Order by Last Name and First Name
- Pagination for custom php code
- get_posts of Custom Post Type AND Custom Taxonomy
- What’s the difference between same wp functions get_posts(); functions in different form?
- Changing number of posts per page on CPT-archive.php, have tried 20-30 code chunks so far
- Custom Post Type Loop throws 500 error when used in widget
- how to check if custom post type column already exists?
- Get posts from a custom post type by child categories of a parent category
- Received nothing after executing AJAX post function
- How to make sure content doesn’t display if selection is empty
- how to remove metadata from the posts of my blog?
- Custom Post-Type not in admin menu
- get the custom post type title/name
- Page vs Custom Post Types Differences/Issues
- If post has custom field then display css-class
- Push metadata in array
- How to customize a permalink (URL) structure?
- Troubles with saving metabox
- CPT + CMB2: data not displaying for only first post in loop
- How to make a field appear only if a post meta field has a defined value?
- Replace text in post from cvs
- Get parent categories of custom post type
- Can I list a custom post type within another custom post type in the admin area?
- Get custom post type list for every category shortcode
- How do i calculate the total of values of custom fields in custom post types?
- Customize my custom taxonomy table in Admin panel
- I would like to have different styles for my posts based on the content of each post