add helper function to determine if a sidebar is needed based on post template settings, refactor sidebar.php to use said helper function, other minor tweaks