How can jQuery or jQuery-UI scripts be properly included in PHP when using partial() for sidebar content?

To properly include jQuery or jQuery-UI scripts in PHP when using partial() for sidebar content, you can add the necessary script tags directly within the partial file itself. This ensures that the scripts are loaded whenever the sidebar content is included on a page.

// sidebar_partial.php

<?php
// Include jQuery script
echo '<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>';

// Include jQuery-UI script
echo '<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>';

// Your sidebar content here
?>