Post pages in Wordpress 2.9 - wordpress

I'm trying to use a posts page in Wordpress. For the uninitiated, this is a page (other than the home page) which features all your blog posts. You essentially turn on the static home page and point Wordpress at a custom index. Then you tell Wordpress to use another custom template as your "posts page"; thereafter, any post you make will wind up there.
My custom template for the 'Blog' page shows up as expected until I define it as the posts page. When I do, the template reverts to my custom index and I get no posts. When I undefine it as the posts page, it goes back to my template. What am I missing? I'm new to using this method, as it used to be done with a plugin prior to WP 2.9

So, I figured out the solution and wanted to share. Thanks for all your input, everyone.
The problem was with the name I chose for the template. I had called it "blog.php", which works fine when creating an ordinary page template. But when using a page as a posts page, Wordpress has some specific setup rules. The pertinent section of documentation, which I scoured the entire internet for using hours of my life I'll never get back, is hidden here:
Also, any Template assigned the Page will be ignored and the theme's index.php (or home.php if it exists) will control the display of the posts. (from here).
So, I named my template "home.php", since I wasn't using a home.php in this particular install, and I was off to the races. Anyway, thanks for the answers!
BTW, I think this may have been what Richard M was getting at.

Your problem might be in creating "templates" and the single post (single.php) You can create a template for any of your pages by putting this in the top of your page (after the first < ? php:
/**Template Name: ****templatenamehere**** #package WordPress * #subpackage Default_Theme */
...rest of code
This allows you to create a page called "posts" which references your new template. This way you can create a new template and then call it through a page. If this is confusing or you have tried this let me know and I will try to give you more details if you need. Thanks

Related

Wordpress template assignment not working as expected

Whilst risking duplicating another post, I think this may be unique as other similar posts I've read haven't given me an answer that works for me. I have spent hours going through answers in other posts to no avail. I feel like what I've done should be working, but for some reason isn't.
I am new to Wordpress (but not development in general), and have set up a custom theme and page template (called index-gallery.php based on index.php and modified slightly to pull out my custom gallery posts). I have assigned that template using the page template dropdown on the right hand side of the page edit screen (using the remarked template name 'gallery page' that shows up fine in the list). So, you'd expect that to over-ride the standard hierarchy settings. However it isn't being applied and I'm seeing the index.php template being used. However, if I change the parent page of my 'gallery' page to be the home page it suddenly uses the 'index-gallery.php' template and the template works exactly as I'd expect. So I know it's not an issue with the template itself, as it works in that instance. I'm using 'what the file' plugin to see what templates are being used. I've tried re-assigning the slug in the page edit and re-setting permalinks etc, but that hasn't solved it.
Does anyone know what may be getting in the way of the template assignment when it's not parented to the home page? I don't really want it parented in that way.
This is all set up on my localhost running on xampp using Wordpress 4.9.7
You should rename your template files to something else (that doesn't begin with one of the standard WP template file names) - such as template-gallery.php
Oh, and you might find it better to base page templates on the page.php file anyway.

Add HTML Snippet to Wordpress Blog Page?

I have recently started working with Wordpress, and I use the HTML Snippets plug-in to fill in the contents of each page. This works well until I hit the blog page. My blog page does not take anything from the page editor, so I can neither paste code snippets nor write anything in the WP page editor field. It only responds to posts. As a result, I am unable to add anything static to my blog page. Also, editing the template post_list file also leads to damaging the template.
How do I go about adding static elements to my blog page?
Essentially it sounds like you're wanting to add a page template to your theme, which you can then assign as your 'Posts' page through the Wordpress admin.
The question itself is rather too broad to answer without an attempt at coding it yourself, but you can read more about it on the codex: http://codex.wordpress.org/Page_Templates#Creating_a_Page_Template

How to add custom URLs to my WordPress template files?

I'm developing a WordPress theme and I need to have a custom URL for some kind of content.
For example, I need to have a page to show some article details. Now, i've created a page template called "Article", and so i've to create a new page and give it the page template "Article"
(I get the url http://mydomain.com/article?id=123)
It works fine, but now i'm having dozens of this pages, and it's a mess to create them all on every installation of this theme, so i want to do it in my theme code.
I saw something near that on BuddyPress, where you can use /member/ and it redirects to a member page. I just wanna know how to do so.
Thanks!
If you are running wordpress 3.0 I would recommend making a custom post type for your articles. That would allow you to control the URL in the way that you want and also allow you to use more sophisticated full text urls if you wanted to.
Here are some links to some tutorials about how to make a custom post type to get you started:
http://kovshenin.com/archives/custom-post-types-in-wordpress-3-0
http://kovshenin.com/archives/extending-custom-post-types-in-wordpress-3-0/
The second one has an example file that you can download and edit to help you get started.
Cheers,
Paul

Wordpress Not Publishing Posts To Custom Template

I am building a theme that has a lot of custom templates, like every page. Ridiculous, but for some reason the template I made for the "postings" page is not getting the posts? I have set the post page in reading preferences, and I have set the page to use my template, but it still publishes posts to a default template. Of all the customization I built into this I did not expect the blog part to give me trouble! lol Anyone run into this kind of thing?
Thank you.
The way I usually to it is to have standard setting in reading preferences.
Build my front-page in index.php
Build a template for blog posts
Add a page and assign the blog post template
Of course you then have a kind of placeholder page sitting amongst the other pages, don't really like that. But it works.

Wordpress blog page

Quick question (quick deadline...I know I can use google).
I'm writing a site on Wordpress w/ a static home page, it has a few pages--I want the 'blog' page to show the wp entries...what's the best way to set this up.
Right now I have a static template for each page (with content rendered), but of course, the blog page doesn't show the posts...
Thanks for the help!
Create a Wordpress Page Template by making a page with any name and this comment at the top:
/*
Template Name: Blog Enitres
*/
Go create a page, use that as the template (there is a selector on the right hand side). Call it whatever and save it. This is your static page.
Then, after that, go down to Settings > Reading and change the 'Home' page to be the page you've created.
Then create an index.php and save it. This will be the template for the displayed posts. Create an empty page and select it at the 'Posts Page' in settings.
To learn more about this functionality go here.
To learn more about the Wordpress loop and how to display entries, visit codex.wordpress.org

Resources