Hi Cristain,
I tried a couple different plugins for adding categories to pages. I ended up on Taxopress. All plugins tested seemed to do a good job adding categories to pages. But the php code kept failing.
After spending time debugging the php code it became apparent the problem was the is_category function. It was always returning false even if it appeared it should return true.
After doing some research I tried using the in_category function instead. Using this function, the php code began working as intended. Solved.
On a related note, while poking around at all the category screens in WordPress, I stumbled across the “Require Custom Capabilities?” field on the WordPress Page -> Edit -> sidebar. I had not noticed that before. It provides the same functionality I was originally looking for without the php code. Would have saved me a few hours of php debugging!
Thanks for your help,
James