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
Related
In my sites I use static page as a front page, and I did some other static pages to show some special static content (and embedded object) but this page sin particular I want to have the comment area shows.
My question is: how to enable comments -preferred hard code- in particular pages? at least having the same category?
I am using wordpress 4.1 and Avada Theme.
Well you can disable the comments on over all website by going to settings discussion and then uncheck the box that says, allow people to comment on new articles. This will remove all the comments on new pages and posts (starting from now). Now when you create a new page/post click on the button on the top that says "screen options". Check the box that says "discussion". Now you will have a new field in your post from where you can enable/disable the posts individually.
If you want to do it through the code, one way would be to create separate files for each page e.g page-contact.php, So when someone goes to the contact page, this file will be served, it can be a clone of page.php and just needs the comment part removed. Another way would be to goto page.php and wrap the comments code with a condition like
if(is_page('contact') || is_page('about')){
// code to show comments. Comments will be shown on contact and about page
}
I chose Wordpress for my last project but I have a question. I'll use Pages so the client is able to change the content himself. For the moment there are no Post or blog in it. Is it possible to run Wordpess without a blog? It'll be a blog in a future but not now. Thanks.
Absolutely you can have a WordPress site without a blog. You just need to do a couple of things in the admin.
First you need to create 2 pages: a static 'home' page, and a 'blog index' page. The home page is what will be displayed when a visitor comes to the site. The blog index page is just a blank page, with a title you can remember.
Next, in Settings > Reading, select Front page displays a 'static page', then set 'Front page:' to the home page you made, and 'Posts page:' to the blog index page you made.
Yes, for sure you can do this.
Just do the following:
In your admin backend click on Settings -> Reading and set "A Static Page"
Go to Appearance and build a custom menu and add there your pages to a active menu.
Disable all widgets which link to posts.
In fact you need only the first step, but with the second you allow users to navigate on your site. To make the UX better, just add a plugin like Map Categories to Pages to add a category widget or something in this way, to let people browse your site more nicely.
I have WordPress installed in the main directory. I want to create a static page so that when the person clicks "click here". It goes to the wordpress blog.
I have tried this two ways thus far.
Created a custom page in wordpress and then had it set as a static page. Problem when someone clicked the linked it redirected back to the splash page.
Put the files in the main directory. Problem the person would have to go to www.example.com/splash.html to get there. I tried creating a htaccess but host gator will not let me.
edit: I figured it out using
<?php
if( (strpos($_SERVER['HTTP_REFERER'], get_bloginfo('home')) === false) && !$_SERVER['QUERY_STRING']) :
?>
What is the purpose of the splash page if its just one link on it?
One option is to create your page within wordpress and set the frontpage to show as a static page (under settings > reading). On that page link to your /blog/ category or to a custom template page that displays all your blog posts.
If you want to have the same design as the page currently has, you can make a new template out of you current index.php file.
http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates
The simple option is to use a plugin.
http://cochinoman.com/2009/02/16/wordpress-plugin-for-splash-screen/
Gives you the option to Continue on or go back.
I didn't think I would encounter this kind of problem in creating a static front page because this seems to be a very trivial customization of wordpress. I am using Thematic as my parent theme. I created a home.php template and pasted the code from the parent's page template into it. I also created two new blank pages named Home and Blog. I set home.php as the template for page Home. Then I went to Settings->Reading and set my front page to a static page and selected page Home. I also set posts page to page Blog. Now when go to my Blog page, I only see a single post?
What is set for "Blog pages show at most" in Settings>>Reading? Do you have more than one post?
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