I have just encountered a small but weird problem in WordPress. I have made page called 'nyheter' (translates to news in Norwegian), where I have made a custom page having a 'page-nyheter.php' in my template folder where I want to display all the posts on the website.
Please keep in mind that I don't want to display any posts on my front page.
I do also have a custom static front page that is just 'front-page.php' which works fine navigating to. However, choosing my front page as the homepage, and the 'nyheter' page as the posts page in the settings, ends up showing the homepage on the 'nyheter' page as well. All of the other pages works fine, and if I just remove the 'nyheter' page from the custom posts page, it works fine again.
What exactly am I doing wrong here? Could someone please help me?
The Posts page will use index.php for it's template, and the Static Front Page will use front-page.php
Is the Nyheter page powered by posts? Why not use index.php since is most suitable for posts than a page template.
https://wphierarchy.com/
If you are a developer please enable wp_debug to true. Then check your errors.
Related
I was trying to get rid of the Welcome section on the front page of a WooCommerce site I am building. The site is using the Storefront theme.
I thought the way to do it was to delete the Welcome page from the Pages section of WordPress. However, as soon as I did that, the entire front page of the store is gone and it is back to what seems like a regular WordPress.
Using "Create default WooCommerce pages" feature of WooCommerce does not seem to work as it neither fixes the display of the front page nor creates another Welcome page.
I have several questions.
1. What went front?
2. How can I fix it, so the store displays again.
3. How can I get rid of the Welcome section on the front page without blasting the entire page off the site?
Any advice is appreciated.
P.S. I should mention that I originally moved the Welcome page to trash. I then saw that it broke the site. In turn, I attempted to restore it, but it didnt fix the issue. I then deleted the page permanently in hopes of recreating it with the WooCommerce functionality. The latter didnt work.
You need to use the WordPress theme Customizer
under front page you have the option to choose a page your blog as a front page, here you just need to select the page that you deleted and then restored
this link may be of some use to you... https://atlantisthemes.com/change-storefront-homepage-layout/
I want to modify the Index page or the Landing page of my WordPress site so that it looks different from the rest of the site. Essentially I want the body of the index page to be 5 large rotating pictures with the same static menu and header as the rest of the site but I'm not sure where and what I need to edit to make this change. I assume it has something to do with the theme itself but I thought I would ask here first to see if anyone has any expert opinions. Thanks!
You can set a static home page by going to Appearance->Customize->Static Front Page. Then create the page under Pages->Add New. You can add whatever custom code, images, etc. that you want on that new page. With most themes, your site's header and footer will be displayed on the page automatically.
From the codex: http://codex.wordpress.org/Creating_a_Static_Front_Page
As the title says, I'm currently working on a theme and i've found a bit of a problem.
Let's say I make a page called test and give it the custom page template of test-page-template
so far that works fine if I go view the page but the problem comes when I set the homepage to use my page as the static homepage; what happens is instead of using the test-page-template it uses front-page.php.
The obvious work around would be to edit front-page.php to be the same as test-page-template but that's a bad solution if a client wanted to select a different page as the static front page. Any ideas?
This is happening because of the WordPress template hierarchy. Front-page.php takes priority as compared to page template, when it comes to the front page of the blog. Here is the heirarchy graph:-
I'm not sure of the complete requirements, but I would suggest you to use index.php and page templates in that scenario.
I am trying to add the custom field "market" into the a href as links, which is working great on pages, however is not working on my home page.
The PHP is identical for both.
For the home page, the php is in the functions.php file, and for the theme-by-series page the PHP is in the page's .php file.
The page works, so it doesn't seem to be anything wrong with the PHP, seems more like it for some reason is not targeting the post id as it should.
Anyone know how to solve this?
Custom fields are saved per post/page, and this is likely why it's not loading on your index.php page. You need to replace $post->ID with the ID of the post/page you want to show your custom field for - the $post object is available on the page.php and single.php templates, which is why it works there. On the index page, it would only be available inside the loop.
Look up the WP Docs on how to Reset the main WP Loop Query:
http://codex.wordpress.org/Function_Reference/wp_reset_query
If you're getting different results in functions.php vs a page template, there's a good chance its because your page template has already started a query loop and its conflicting somehow. This is just off the cuff without looking at the code. I'm going by your description of the difference betweeen working and non-working models.
I'm having a bit of trouble with Wordpress, I want my blog posts to show on the news page, so I selected that page in the settings tab.
The blog posts show but I want to change the page template, I created a new template which works on all other pages but when I select it from the page template list within the 'news' page it doesn't change but instead just stays the same.
There is no blog.php file, I've even tried changing the standard page.php expecting it to be falling back onto that but it is not! I've tried changing the archives page too but nothing seems to change it!
Any ideas?
It won't be page.php which shows a single page view and you're right, there is no blog.php. Wordpress uses a template hierarchy for displaying lists of blog posts.
As you can see from this diagram - Wordpress template hierarchy
For archives like your News blog page you are looking at category.php, archive.php and then index.php (depending on your theme and which template files you've got).
Rather handily your problem is exactly the same as the working example used as a demonstration in the Codex link I've given above, so this should help explain things more.