1. Posts Table Pro
  2. Developer documentation

Template functions

ptp_get_posts_table

This function can be used in your theme or plugin to retrieve a posts table, passing a list of arguments as an array.

Arguments

array $args - The list of arguments to create the posts table. The array keys supplied should match the shortcode option names. List-based arguments (such as the columns option) can be passed as a comma-separated string or an array.

Return

string - The complete HTML for the posts table.

Example
$table = ptp_get_posts_table( [
    'columns' => 'title,author,date', 
    'filters' => true, 
    'category' => 'featured'
] );

ptp_the_posts_table

Similar to the above function, but will print (i.e. echo) the table output, rather than return it.

Example
echo '<h2>Featured posts</h2>';
ptp_the_posts_table( [ 
    'category' => 'featured',
    'lazy_load' => true
] );
Arguments

array $args - The list of arguments to create the posts table. The array keys supplied should match the shortcode option names. List-based options (such as the columns option) can be passed as a comma-separated string or an array.

Related Articles

Still need help?
If searching the knowledge base hasn't answered your question, please contact support.