Multiple template pages (index single etc) vs is_single statements
-
Not so much a problem as a question.
I’ve noticed that it is possible to either create separate template pages such as page.php, single.php, or you can combine many of these functions in a single index.php page using statements like is_page or is_single to specify differences where necessary.Now, I only discovered this by acident while fiddling around with the code & seeing how something had been done in a different theme, but I was wondering if there was any consensus as to which was the better approach to ake, or what limitations I might not have noticed.
The advantage of combining the page is that if there are a lot of similarities & you want to modify the theme then you only need to update things once. The most obvious dis-advantage is that the index.html page ends up more complex than it would have been otherwise.
I am hoping that now when I want to update aspects of my theme that are common to a lot of pages, such as the meta data above & below the posts, then it will be a lot quicker than it was previously, where I copied & pasted between various files (& there is always a chance when doing this that you accidentally overwrite some slight difference that was supposed to be in the statements before.)
Does anyone else have any thoughts or opinions on how they treat this issue?
- The topic ‘Multiple template pages (index single etc) vs is_single statements’ is closed to new replies.