Any tag pagination page (except the 1st page) loads index.php template instead of tag.php
Overall CODE issues: Your CODE is so wrong in so many ways that I shouldn’t even attempt to address them here. I suggest you study Official WordPress Theme Handbook properly before doing these sort of customizations. For the sake of the context, I’m ignoring other issues within your CODE and touching only the issues below: … Read more