Filters and Hooks

This page will be further developed and organized as additional use cases are identified and documented.

Hooks and Filters

Anyone using hooks and filters should be sophisticated enough to search the plug-in files – mainly in “construct.php” – for “do_action” and “apply_filters.” A list has been provided below, but note that these are continually being added and refined. If you need a new one, let me know!1

One potentially very useful hook for anyone tailoring the Link-Posts table to archiving uses would be adding parameters to the main WordPress queries that produce the tables.

There are two filters for this purpose, one for shortcode tables – cks_lpa_table_query_sc – and one for all other tables – cks_lpa_table_query.

So, if, for some reason you wanted to…

…select posts only for the month of April in your shortcode tables…

…you could add the following to your functions.php:

That’s not really very practical, however. A more likely use would be to change the date query on a per table basis. To do that, you’ll need additional information to work with, and the possibilities are endless. Some examples:

Return posts from April, 2016, in the LPA shortcode table in post with ID# “64280”

Return posts from the month before the current month in template and widget tables

Return only those posts with thumbnails in specific shortcode table, and only up to 4 of them

Reference

Hooks

Filters

 Adding Template Arguments

Every argument available via Main Settings is also available via argument array in the “Add to Template” function – so:

Add Link-Posts table to template with 15 posts per page, linking to local post instead of to source, with “day” headings

Reference

The available array arguments tend to expand as the plug-in evolves, so advanced users will probably want to look at the main “linkpost-aggregator.php” file for the current list, under the cks_lpa_default_options() function. The current version as of this writing on 8 September 2016, offers some 43, as shown here with their initial defaults (the __( 'text in English','cks_lpa') is for translation readiness):

So:

A simple “news” page template combining LPA tables

The following would be saved as, e.g., page-news.php in your Theme folder, then selected as the “News Page” Template (under Page Attributes) when Adding or Editing the WordPress Page.

 

Notes:

  1. …and if one of the examples below doesn’t work for you, it may mean that a “tag” or order of arguments has been changed – please let me know if I missed something! []