How to resolve require_once file inclusion errors in WordPress

Solution:
The issue is that you are using an incorrect relative path to the file. To fix it, use the correct path to your theme directory:

// Step-by-step approach
$filePath = get_bloginfo('template_url'); // Gets the URL of the current theme
$filePath .= '/includes/theme-widgets.php'; // Append the relative path to your file
require_once($filePath); // Include the file

You can also simplify this to a single line:

require_once(get_bloginfo('template_url') . '/includes/theme-widgets.php');

Explanation:
Originally, the function was trying to access:

public_html/includes/theme-widgets.php

which does not exist. Your correct path is:

public_html/wp-content/themes/{theme_name}/includes/theme-widgets.php

The code above ensures the file is correctly included from your active theme directory.