Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    Sounds like a job for the Shortcode API.

    One way or another you will have to run your own php code to do this, shortcodes can do this very elegantly and suit some situations, in other cases you will need to create a custom page template, and invoke your own code while structuring your page.
    Your code will fetch the list of links, then relate the links to the sort order and finally sort the list on this index. This could be done by a sequence of SQL queries, but the game here is to use as few queries as possible, the reason is that the cost of a query is largely independent of its complexity. So your query will be a basic select, with a join to your sort options and sorted on these options. Suggest that you tune your SQL query in phpmyadmin, only when it is working correctly, then incorporate it into your code.

    NB: If you choose the option to invoke shortcodes inside a widget then you need to enable them in that context, details here:
    https://digwp.com/2010/03/shortcodes-in-widgets/
    Which amounts to adding this into the functions.php of your child theme:
    add_filter('widget_text', 'do_shortcode');

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to manage and sort a list inside a post?’ is closed to new replies.