To modify it, you will need to change the code in your my-post-template.php file. Paste this code in my-post-template.php and upload it to your server.Īs you select the template, you will see it is similar to your single post template. Open the single.php file and copy everything after the get_header() line. To fix it, we can use an existing template as a basis. Simply because it doesn't have anything to display. The new template 'Portfolio Template' should be listed there.Īs you select the template, you will see it is empty. In the post window, look for the 'Template' drop-down in Post Attributes. Open your WordPress Admin Dashboard, navigate to posts, and create a new post. If you don't know what it is, check out this quick tutorial on the WordPress Child theme.Īfter upload, it's time to check out your WordPress site to see if the template really works. The file must be uploaded to your current theme folder.īy the way, it is recommended to use WordPress Child Theme. Next, you will need to upload the new template to your web server. Great! You have created a basic post template. Now, it's time to add some content.Ī simple code will create a template named 'Portfolio Template' that will be available for your posts and pages: Name your file my-post-template.php and save it. Notepad should be just fine, although you can use advanced code editors like Sublime or PHPStorm. Creating a Custom Single Post Template in WordPressĬreating a custom single post template in WordPress is really easy. An easy way for everyone to design a single post template with the help of the drag and drop website builder. Probably, one of the reasons why people avoid doing that.Īnd the second way, where you don't need to know anything about coding. The downside is that you will need to have some coding skills to do that. We will look into both of them.Ī generic WordPress way that allows you to quickly add a template to your site. Whatever your reasons are, there are two ways how to design a single post template for you. Maybe you want your blog post to stand out, or maybe you have various types of content published under one post type. Nevertheless, sometimes you need to create a custom single post template. In most cases, it is enough to build a decent blog or portfolio website. This means that you can get one or several post templates depending on your theme choice. Single post templates are usually defined by your WordPress theme.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |