I have registered a custom post in my functions.php. Which post come from custom post category in my page but it does not work on single.php. when i click on read more that created with but don't open as single page.
The template single.php should be sufficient for Custom Post Types, as shown in the Wordpress Template Hierarchy.
This could be a rewrite rule issue. If you are not using the default Permalinks, try switching to them, save, and then go back to your chosen structure for WP to correctly include the rules for your new Post Type.
You could try using a different template to display your custom posts. Try copying the contents of single.php to a file named single-{post_type}.php. See the Codex for more details:
http://codex.wordpress.org/Post_Type_Templates
Related
I've selected a specific page in wordpress to display posts. I also set a custom page template to be used for this page, but is ignored.
The page is displayed using the default template.
I have no idea how to solve it, suppose it's a wordpress bug or something. Using the latest Wordpress.
Thank you
That's the default behaviour I believe.
Wordpress' template for the posts page will be index.php or home.php.
You have 2 options :
You could copy the page template file and call it home.php and make sure it includes the default loop in the markup.
or
Add in a custom loop on that particular template page (read more on inserting a loop here: http://codex.wordpress.org/Class_Reference/WP_Query)
I installed a plugin for wordpress and activated it.
then I post a few of them under this Custom Post Types.
However, how do you view a list view of them (the ones I just posted)?
right now, I can only view a single post at a time. I also see inside the file directory, there a file called archive-xxx.php. I think that's used for displaying a archive or list of all this custom post types. But how do I make sure of it?
Download and try it see if you can create a few posts and display them
http://wp.tutsplus.com/tutorials/plugins/creating-client-testimonials-with-custom-post-types/
The post type will have a page-template to show the post. You need to create a page with that page template. All the posts in that "Custom Post Type" will appear in that page.
You can refer to this or this article for a better tutorial on custom post types.
I have created my custom Post type on WordPress 3.5.1
So under Dashboard I see my custom Post type on the left hand side. So, I did a Add New under this Custom Type.
But I don't see any Template page I can choose for this Custom Type.
I create a file called archive-customtype.php that's a template page and put into my theme folder.
On the older WordPress to change different template you do a
From the Page Attributes meta box select Template > Custom Type and publish the page.
So my question, on this new 3.5.1 where do I select the template for this custom post type?
Right now it's using the default one.
Install the Custom post types plugin by iLocalize http://wordpress.org/plugins/types/. They have a lot of tutorials on how to add the custom posts to a page. This tutorial http://youtu.be/1SXyHbgjYaI here is the best I've found but there are more the wp-types website. Look up how to create a new page template on wordpress . org and place the code from the tutorial to the page template. Hope this helps.
When a post is cross-indexed, how do you control which custom (category-based) template wordpress displays? It seems uncontrollable at first glance, but I'm sure there's a way.
Do you put paramaters into the query that generates the link to the post, or wha?
Thanks.
If you're trying to display a certain template for a specific category, Wordpress has you covered. Simply make a template with the name 'category-%slug%.php', stick it in your theme directory, and when you view that category, you'll see the template that you created.
More Info on Wordpress Template Heirarchies
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