@morvy that would work, though I prefer to use the existing functions on the plugin object.
@Simplicitie First follow the instructions in my previous post in this thread (copy the function).
After that you can add the following code in
Add the following code at the end in the function
Now in your pages you can do
@Simplicitie First follow the instructions in my previous post in this thread (copy the function).
After that you can add the following code in
functions.php
: PHP Code:
function get_all_category_links($categories)
{
$result = '';
foreach ($categories as $cat)
$result .= output_category(return_category_name($cat), return_links_raw($cat));
echo $result;
}
/* here you can define your output */
function output_category($category, $items = null) {
$template = '';
if (count($items) > 0) {
$template .= '<h3>' . $category . '</h3>';
$template .= '<ul>';
foreach ($items as $item)
$template .= '<li>' . $item . '</li>';
$template .= '</ul>';
}
return $template;
}
Add the following code at the end in the function
lm_filter
in functions.php
(starts at line 87):PHP Code:
/* (% link_categories:id[,id,..] %) */
$content = preg_replace_callback('/\(%\s*all_category_links:((\d+,*)+)\s*%\)/',
function($matches) {
$categories = explode(',', $matches[1]);
$result = '';
foreach ($categories as $cat) {
$id = intval($cat);
if (return_category_name($id))
$result .= output_category(return_category_name($id) , return_links_raw($id));
}
return $result;
}, $content);
Now in your pages you can do
(% all_category_links:1,2,3 %)
, and in PHP <?php get_all_category_links(array(1,2,3)); ?>