I have written a function that inputs content (title, timestamp, comment count, widgets, sections etc) into pages depending on the page.
My code is redundant, but I don't understand PHP well enough to make it not as repetitive. I also am running into a few errors where incorrect info is being added to the page. I believe I am passing an incorrect ID or I should be passing the ID in a different way or maybe this is because I am outside the loop? I am not sure...
The end goal is to have this function reduced in size (cleaned up with not as many if statements and not as many attempts to get the ID) and for it to accurately check and input the content I am asking it to input (home page, archive page, category page, taxonomy page, single page, regular page, search page, 404 page etc... you get the idea)
I'll walk you through my function for you to understand what is happening - but it's pretty straightforward. Functions are placed in my pages and these functions are only called if the page has checked the section to show. See screenshots for more info.