Where should I write custom functions

Hello everybody

I have a function that is, custom_pagination() what I have placed in extras.php. When I call this function into the custom template, it does not work. If I placed this function at the bottom of functions.php, it works. I can see in functions.php that it is written in the comment that custom functions should be placed in extras.php. Can you tell me someone how should I call the custom functions from extras.php to custom template or page or anywhere in the theme.

Thanks in advance

thanks I got it. It works not.

Okay what I did is,

use Roots\Sage\Extras;

But I want to call this function inside function_exists().is it possible, if so how can I do?


if (!function_exists('Roots\\Sage\\Extras\\custom_pagination')) {
  // do stuff if it doesn't exist...

Or if you’re within the same namespace…

if (!function_exists(__NAMESPACE__ . '\\custom_pagination')) {
  // do stuff if it doesn't exist...