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
- 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.
$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.
Arguments
array
- 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.
echo '<h2>' . __( 'Featured posts', 'my-plugin' ) . '</h2>';
ptp_the_posts_table( [
'category' => 'featured',
'lazy_load' => true
] );
If searching the knowledge base hasn't answered your question, please contact support.