|
#1
Jan 3, 2011, 07:28 AM
|
|
|
|
82 posts · Nov 2010
London, UK
|
|
I am writing a simple e-commerce plugin (for Google checkout) using a WP3.1RC-1 custom post type to describe each 'product'.
I want these post types to be treated by default, more like a static page than a blog post, not just in Atahualpa but in general in any theme so I'm interested to know:
1) How Atahualpa (and themes in general) determine how to display a post as a static page (as opposed to a post)?
2) Is there a way, which is not theme dependent, to cause my custom post type to be treated like a static page when formatted?
Thanks
Mark
|
#2
Jan 3, 2011, 09:02 AM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
you should truck on over to codex.wordpress.org and do some reading on Pages
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#3
Jan 3, 2011, 10:22 AM
|
|
|
|
82 posts · Nov 2010
London, UK
|
|
I've already been reading about this, but so far have not found what I need. Its generally assumed this is going to be done in the theme (e.g. with single-custom_post_type.php) which is not very useful when a plugin is adding its own custom post type.
|
#4
Jan 3, 2011, 12:00 PM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
each page can be identified by the class 'page' that is assigned to <body>
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#5
Jan 3, 2011, 12:34 PM
|
|
|
|
82 posts · Nov 2010
London, UK
|
|
thanks, but I don't understand this. possibly because I don't understand WP very well yet, so I need more info. Here's my understanding of what you are saying (please correct!)..
1) <body> can have <body class='page'>
2) I can somehow cause this to be set for my custom post type (how?!)
3) This will somehow cause any WP template to display my custom post type as it would any static page.
I don't get how 3) can be so. I'm assuming that a template somewhere does "is_post()" or something and generates different HTML elements for a post than a static page (e.g. author, comments for post but not for page). I don't see how setting an attribute on <body> will affect the structure of the output (while obviously it will affect any styles).
Please can you clarify - have I have misunderstood you?
BTW I went back to look deeper into the codex and still no joy. I've posted to the forum there too so if I find the answer I'll post it here.
Mark
|
#6
Jan 3, 2011, 12:40 PM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
ok, so you want to know how to tell if wordpress is processing a 'page' There is a conditional 'is_page()' that you can use (see http://codex.wordpress.org/Conditional_Tags#A_PAGE_Page)
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#7
Jan 3, 2011, 01:42 PM
|
|
|
|
82 posts · Nov 2010
London, UK
|
|
I don't think you have understood my question. Based on what you just posted it is: how to get is_page() to return true for my custom post type!
Thanks
|
#8
Jan 3, 2011, 03:42 PM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
Ok I guess I misunderstood your question. There is no built in support for custom post types in atahualpa. If you are writing a plugin to use them, then you need to provide the code/queries to access the info you want to use. If you want atahualpa to display them, then it looks like you need to create a page template for them. If you want the backend to display a customized G.U.I. For that post type, you need to provide it.
There is a lot of info out on the web that could help you, but honestly writing a plugin is not a subject for this forum
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#9
Jan 3, 2011, 05:24 PM
|
|
|
|
82 posts · Nov 2010
London, UK
|
|
I'm sorry it was off topic - which lead to the confusion - which is still there! As I explained, I don't want to customise the template, so I was asking here because I thought people who understood how templates worked might understand how to make a custom post type behave like a page rather than a post. Now I see that this is probably more deeply under the hood, so I am a bit wiser about where to look.
Thanks for trying to help, especially as I was off topic.
Mark
|
|