If you have troubles since the update to WordPress 4.5 please read this post before opening a new thread.
Now that you require templates for every page and posts where does one add custom code below lets say the title of a post?
I need to move the icons that are in Newscast’s posts (under the titles) to under the titles of posts in Brightbox. ie I need to edit the code of the template for single.php…where are those located now? Are you storing the templates in the database?
In single.php, you’ll see a reference to get_template_part. This function allows code to be reused in different areas without needing to make many changes to different template files to make adjustments. Think of it like using CSS rather than inline styles; 1 update can be used in lots of places quickly.
get_template_part( 'includes/loop', 'index' );
calls the file /includes/loop-index.php (relative to the theme file calling it), and there are fallbacks if the file doesn’t exist. You can make your changes in the /includes/loop-index.php file which will be reflected everywhere the file is called.
For full information, see the Codex article on get_template_part.
The topic ‘Adding icons below the single posts titles’ is closed to new replies.