LPH
Well-known member
I would like to add a php script to pull the latest resources added to the resource manager to the bottom of my WordPress side of the site.
Here is my work so far, untested. As you can quickly see, something is not making sense on the url portion. How do I link to the resource?
Updated php code in this post for anyone interested in using it.
Here is my work so far, untested. As you can quickly see, something is not making sense on the url portion. How do I link to the resource?
PHP:
<?php
/* Script to pull the latest updated resources from the XF Resource Manager*/
/** @var $resModel XenResource_Model_Resource */
$resModel = XenForo_Model::create('XenResource_Model_Resource');
$fetchOptions = array(
'limit' => 5,
'order' => 'resource_date',
'direction' => 'desc'
);
$rmupdates = $resModel->getResources(array(), $fetchOptions);
foreach ($rmupdates AS $rmupdate)
{
echo ("<div class='entry-meta'><a href='/community/" . XenForo_Link::buildPublicLink('resources', $rmupdate) . "' >" . $rmupdate['title'] . "</a> Downloaded: " .$rmupdate['download_count'] . "<br /></div>"); // Echo the title with a link.
}
?>
Updated php code in this post for anyone interested in using it.