I'm looking to add some more .hbs files to ghost/custom/themes/casper, such as an about page and landing page. This way, all files are using the same default layout and I have a /blog destination for my blog.
However, when I create an .hbs file, such as about.hbs, and give it the same code as in page.hbs, and upload it to the theme folder, when I go to my-url.com/about, it gives a 404.
So, how can I create custom .hbs pages?
Create the page with the specific slug in the Ghost backend.
Create the .hbs-file named like this: page-about.hbs.
From Ghost Documentation on custom pages:
For example, if you have an 'About' page with the url /about/, adding a template called page-about.hbs will cause that template to be used for the about page, instead of page.hbs, or post.hbs.
These templates exist in a hierarchy. Ghost looks for a template which matches the slug (page-:slug.hbs) first, then looks for page.hbs and finally uses post.hbs if neither is available.
Related
I'm trying to create WP site with different templates with different functionality but in same web page with same header and footer.
So my question is, Is Page Hierarchy (page-about.php) different than Template Hierarchy?
If its different thing, can i use both of them in same page?
Ex: templates/about.php + pages/about.php = about page with about template etc...
The template hierarchy boils down to how WordPress decides which template to load when a URL is requested (when you type a URL in your browser address bar). In your question above, you mention page-about.php - this is one of the many templates you might have in your theme folder. When someone requests the page example.com/about on your website, WordPress will load the page-about.php template because it is the best match according to the rules in template hierarchy.
For info on exactly how the template hierarchy 'matches' URLs to templates, see:
https://codex.wordpress.org/Template_Hierarchy
I am creating my first WordPress theme with a one-page parallax scrolling style.
I have created my entire website (statically) in the index.php file. It works fine if I set the Admin->Reading setting to 'Your Latest Posts'.
But now I am trying to create a separate page for the blog so I did the following:
I created a file, page.php, with the standard blog page code and gave it a template name.
I set the Blog page on wordpress to use the Blog template.
All other pages (i.e. home, about us, etc.) are set to use default
page template (which should be index.php right?)
I set the Reading settings to Front Page: Home and Posts Page: Blog
All I get is the blog page template for all pages (as if it were the default page template).
How to set up a website like this?
index.php should really be your blog template not your static home page. Make a copy of page.php to page-home.php (or whatever you've named your front page), then put the static content in there. You probably won't even need to assign the template to the page - WordPress will do that automatically based on the file name.
By default, page.php is used for all static pages, index.php is used for whatever you've assigned as your blog page in the "Reading" section of the dashboard. index.php is also the template of last resort, which will be used if WordPress can't find any other appropriate template files.
I have a WordPress Website www.bccfalna.com and I have created some Custom Taxonomy. Everything is working well when I use following URLs in my web browser:
domain.tld/Texonomy/Term/
which is equal to :
taxonomy-{taxonomy}-{term}.php
Format specified at WordPress Documentation. But I am very confused about What URL I use in my Web Browser, so that I can use following URL specified at WordPress Documentation:
taxonomy-$taxonomy.php
I mean, I have created a Template taxonomy-$taxonomy.php, But I don't know about What URL I use in my web browser, so that WordPress can run taxonomy-$taxonomy.php Template and I could see the Output.
If you want the taxonomy-{taxonomy}.php template applied to term archives, do not create individual taxonomy-{taxonomy}-{term}.php files. From the Codex, this is the hierarchy:
taxonomy-{taxonomy}-{term}.php
taxonomy-{taxonomy}.php
taxonomy.php
archive.php
index.php
Note: in WP, 'general' taxonomy archives (i.e. an archive page showing all posts using terms belonging to a certain taxonomy) are not available out of the box, compare example.com/tag/ or example.com/category/.
PS: You can use this plugin during development to reveal templates being used.
i want to have a custom php file on one of my child sites of Wordpress multisite network.
For example: child3.mydomain.com/somecustomfile.php
How do i do this?
This might not be what you are looking for, but this is how I used to solve this problem:
In the specific child site, create page with your any name (but remember the page slug!). In the theme, create a file named page-slug.php (replace slug with the slug of the page you just created). The file is now accessible under the URL of the page you just created.
i'm wondering if it's possible to add a php file in your themes folder (wp-content/themes/classic) where the css file is, then link afterwards? Because i'm currently trying to add a register.php into my blog but i still need the header and everything else.
Yes. For example, if you want something like www.yourdomain.com/test follow this steps:
In your theme folder create a php file called page-test.php.
From your dashboard publish a page with the title Test(with no content at all).
Now, when you'll go to www.yourdomain.com/test you will se your page. And in page-test.php you can use all Wordpress functions such as get_header(), get_sidebar() etc.
Yes. What you want is to define a new "page" template, and then to create a new page in your wordpress using that template. Here's the WP documentation on that topic: http://codex.wordpress.org/Pages#Page_Templates
Alternatively, you don't have to place it in your theme folder; you can put it in the root wordpress folder and have it function outside of wordpress. Then you can change your theme to have a static link to that page, or link to it in some other manner. It would be more difficult to use the header/footer/sidebar template features, though.