Skip to content

Programmatically insert lists

Victor Jonsson edited this page Feb 24, 2015 · 27 revisions
arlima_render_list( $list, $args=array() )

Will return or echo an article list

Parameters

$list (int|string|object) — Either id of an article list, slug name of an article list or an instance of an Arlima_List object

$args (array) Optional — This array contains a set of configuration options.

  • width (560) The width of your list (used to calculate image dimensions)
  • offset (0) From which index in the list to start the iteration
  • limit (0) The maximum amount of articles that should be rendered
  • filter_suffix ('') The suffix added to filters applied during the rendering of the articles
  • echo (true) Whether or not to echo the content of the rendered list, or return it as a string
  • no_list_message (true) Whether or not to echo a message telling the user that the list does not exist in case the list rendering won't show any articles or if the list in fact does not exist.
  • section (false) Use this argument if you only want to render a specific section of the list (read more about sections)

Applying filters

If you want to add filters targeted only to your own rendering of the list you should add the argument filter_suffix. Example:

<?php
$filter_suffix = 'my-list';
function change_text_to_readmore_link($args) {
  $args['content'] = '<p>Read more...</p>';
  return $args;
}
add_filter('arlima_article_content-'.$filter_suffix, 'change_text_to_readmore_link');

arlima_render_list('my-list-slug', array('filter_suffix' => $filter_suffix, 'width' => 250));

Here you can read more about the different arlima filters and actions

This Wordpress plugin was created by Swedish newspaper Västerbottens-Kuriren to give its editorial staff an easy to use tool for customizing the front pages of their online magazines.

Installing Arlima

  1. Download the latest release from github and unzip the folder in your plugin directory.
  2. Open up wp-admin and activate the plugin.
  3. Go to "Article lists" -> "Edit lists" in wp-admin and create your first article list.
  4. Open up a page (or create it) in wp-admin. Down to the right you will see a meta box labeled "Arlima" where you choose the list that you created on step 2.
  5. Go to "Article lists" -> "Manage lists" and start stuffing your article list with interesting content.

Top links

Clone this wiki locally