I have a problem: I’m trying to pull some pods data into a sidebar widget. I have set up a plugin which creates and registers the widget in WordPress, but when I add the following code to initiate my pods data, I get the following error message:
Fatal error: Call to a member function findRecords() on a non-object in C:webserverpublic_htmlaelwp-contentpluginssidebar-plugin.php on line 39
Here is an excerpt of the code I’m using to get the data:
PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$events=newPod('events');
$orderby='date ASC';
$portfolio->findRecords($orderby);//order by here
$total_rows=$portfolio->getTotalRows();
if($total_rows>0):
while($events->fetchRecord()):
//set variables
$name=$events->get_field('name');
$date=$events->get_field('date');
$location=$events->get_field('location');
?>
...data goes here...
<?phpendwhile;
endif;?>
It seems that the Pod() method is not registering when I call it from within my plugin – can anyone offer any help on this?