0
votes

I want to write a simple plugin that calls API of a website I use and gives back list of links/urls back to me.

I am trying to follow the gazillion "write your own simple wordpress plugin" links but not getting it right.

This is what I've done: 1) created a plugin file under plugins/myplugin.php which looks something like this:

function myplugin()
{
   // making api call via curl
   // return the result
   return $result;
}

I've activated this plugin in wordpress admin panel.

I want to call this on a specific page of my website. That page is written in php.

I am doing simple <?php $blah=myplugin(); echo "$blah"; ?>

But its not doing anything. What am I missing.

Edit:0

When I do "view selection source" on the page where I am trying to use this function, I get:

<div class="post">
<!--?php $blah=myfunction(); echo "$blah"; ?-->
</div>

Does that seem correct?

1

1 Answers

1
votes

Are you sure that $result contains any information at all? If you use echo statements inside of myplugin() that will print on your site. Because from what I can see you're not doing anything wrong.

Also, obviously, make sure that you call your plugin from the current template.