Wordpress - Display post like loop.php into a page template
I开发者_JS百科 want to make an wordpress portfolio page with 2 languages. In main language it's fine. For the English (second) language I added another page (in admin panel) and I made a new template page and inserted the code like in the loop file, but it's not showing the post like in the index (loop) file.
Can I do that in any way?
Practically I need a template page that will loop trough my post. Thank you!
Yes, that should work. Make sure that in your template page you've named the template in the comments at the top. Here is an example from TwentyTen:
/**
* Template Name: One column, no sidebar
*
* A custom page template without sidebar.
*
* The "Template Name:" bit above allows this to be selectable
* from a dropdown menu on the edit page screen.
*
* @package WordPress
* @subpackage Twenty_Ten
* @since Twenty Ten 1.0
*/
Then also make sure that when you're editing the page in the admin area, that you have the template you've just defined selected from the "Page Attributes" box.
Hope that helps and let me know if anything is unclear.
If you've already done all of this and it's still not working. You should post the code from your template, so I can take a look.
UPDATE:
Try adding query_posts('post_type=post');
(or whatever arguments you want) at the top of that code, and it should work.
http://codex.wordpress.org/Function_Reference/query_posts
精彩评论