• Resolved xmarksthespot

    (@xmarksthespot)


    I am relatively new to WordPress but have now just realised that the fact that categories only apply to posts (and not pages) is a bit of a shortcoming for my website. I discovered Pods today and it could be my saviour! – but I need some help please.

    Please bear with me on the scenario…

    I have products, lets call them P1, P2, etc. Each needs a page to describe it. There are currently 4 products.

    I also have locations, lets call them L1, L2, L3 etc. There are about 60 of these.

    There is a many:many relationship between products and locations – the same product could be offered in many locations and the same location could offer many products.

    Originally (and not really knowing any better if I’m honest) I set each location as a category and each product as a post. I then used standard WordPress functionality to display all the products in a category. This seemed OK, but as I didn’t really appreciate the limitations as I now see that each product displays in Google listings with a date against it (as it’s a post).

    So what I want to do is have similar category-style functionality but have the product as a page not a post (as the content is static).

    I’ve read many threads about wordpress not supporting categories (and tags) for pages so maybe pods is the answer?

    Before I start off in the wrong direction, I’d like to know if Pods is the answer and if so, how it could be set up in the simplest form to achieve what I want.

    I know that somehow I need to end up with the equivalent of a database table with the keys of product# and location# – but I’m unsure as to whether the approach is to:
    a) somehow extend a page to support existing categories (can this be done)
    b) set up some sort of different taxonomy
    c) set up locations as a post (page) type, products as a post (page) type and location-product as a post (page) type.
    d) something else

    I’m using the wordpress 2010 theme, however at this stage I’m focusing on building a mobile friendly website using WpTouch Pro first (and then seeing what I need to do to make 2010 look OK).

    That’s just for info, once I have a direction on Pods then I’m sure all will become clear.

    The current site is https://m.xmarksthespot.co.uk

    Some initial guidance/experience would really be appreciated. Thank you.

    https://www.ads-software.com/plugins/pods/

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Contributor Josh Pollock

    (@shelob9)

    Pods is perfect for this sort of thing. You can add a custom post type called products, and a custom taxonomy called locations. Categories and tags are taxonomies themselves, a custom taxonomy functions the same way as categories but are a different set.

    I’d recommend taking a look at our tutorials section: https://pods.io/tutorials and if you have any specific questions about implementation ask here or in our forums and I’d be glad to help.

    Thread Starter xmarksthespot

    (@xmarksthespot)

    Josh, thank you for your reply. Very clear. And good news.
    Have also had another quick look at the tutorials.

    I have now set up locations as a taxonomy. I can now link a page to a location so that is a massive step forward.

    I guess the next logical step is to do as you say with products. I can see that they may be better as a custom post type (and not just an ‘ordinary page’) as I might want to add fields to them so that when the number of products grows it will be easier for users to find them by product attribute.

    I’ll also need to set up frequently asked questions and testimonials as theses are both also currently posts and need to be converted to pages and each given a ‘grouping’ (taxonomy?) so they can be retrieved/displayed.

    Is there any real need/benefit to having them as custom post types? (hope I’ve understood how it works)

    In terms of retrieval/display of ‘categorised’ information, I’m just not too sure yet how to do this. Ordinarily I’d be looking for a category and pulling down the ‘rows’ belonging to that category (and I’ve seen some is_category functions in various places where I could do this).

    What is the easiest way to pull down all the products in a location (presumuing I go with a custom post type for products) and to pull down
    all the testimonials (presuming these just stay as pages).

    As PODS doesn’t require programming I assume there’s a shortcode somewhere perhaps that I haven’t quite found in the documentation yet?

    Finally you suggest “posting here or in our forums”. The top of my page says Forums so I’m a bit confused. (As you’ll see I haven’t quite figured out my way around yet!)

    Cheers.

    Thread Starter xmarksthespot

    (@xmarksthespot)

    Further to my last post, I can now be a bit more specific with an example to look at.

    Regarding testimonials, the current list can be viewed at https://m.xmarksthespot.co.uk/testimonial/

    The testimonials are posts and ‘testimonial’ is a category.
    One example is https://m.xmarksthespot.co.uk/testimonial/american-express-testimonial/

    I then set up a custom post type (page) called ‘testimonials’ with slug testimonial2 (to avoid confusion). I created a page for the American Express testimonial, which displays correctly as:
    https://m.xmarksthespot.co.uk/testimonial2/american-express/

    However, in a hope to see a list by entering https://m.xmarksthespot.co.uk/testimonial2/american-express/
    nothing is returned.

    I am assuming that’s because the page is probably trying to find categories and the custom post type of ‘testimonials’ isn’t a category.

    Is there a neat way to solve this? Clearly I already have the ‘template’ that will list multiple testimonials I just need some sort of fix so that it recognises the custom post type.

    I don’t mind messing around with the php if there’s a straightforward bit of code that needs adding.

    All suggestions welcome.

    Plugin Contributor Josh Pollock

    (@shelob9)

    I’m going to do my best to answer all of your questions, but that’s a lot at once, so please be patient if I miss something. I also wanted to ask if you are adding any custom fields to your custom post types?

    When you say that you have “the ‘template’ that will list multiple testimonials” do you mean a WordPress theme template or a Pods Template?

    Also when you say you want to see a list of testimonial2 posts, I’m pretty sure you are asking for an archive. This is an option that you must enable under the “Advanced Options” tab of the Pods editor.

    We have a shortcode: pods.io/docs/learn/shortcodes/pods/ The shortcode can be used for outputting your custom post types and taxonomies.

    When I say the forums I am referring to the forums on our site at https://pods.io/forums

    Thread Starter xmarksthespot

    (@xmarksthespot)

    Apologies for all the questions. I’m in the UK, so given the time difference I often find it better to ask what I have to rather than ask one thing, wait for a response, ask a follow up question etc etc.

    But maybe it’ll help if I just focus on one thing.

    Let’s concentrate on testimonials.

    Since your last post I have enabled the archive and set up a page called testimonials2. Now when I enter https://m.xmarksthespot.co.uk/testimonial2/ I see a list of the testimonials I have entered using the testimonial2 post type. Result. When I click and one I can see the detail. Perfect.

    However, I’m not quite sure why this worked!

    Apologies if I may be using the wrong terminology. By ‘template’ I merely mean the ‘code’ that generates the list of testimonials.

    This ‘code’ is part of the WPTouch Pro theme. If you look at the code inspector (and I am no expert) of the page it seems to be set up to process categories. So I guess the question I am asking is what would I need to do to that code such that the output looks the same as
    https://m.xmarksthespot.co.uk/testimonial/ ? You’ll see that that page displays the category heading and category description.

    So I think it must be something to do with ‘archive’ versus ‘category’. Grateful for any light you can shine on this please.

    Thread Starter xmarksthespot

    (@xmarksthespot)

    Forgot to say that I haven’t added any fields to the custom post types.

    Plugin Contributor Josh Pollock

    (@shelob9)

    You need to familiarize yourself with how the WordPress template hierarchy works in order to understand the answers to these questions:

    I recommend reading this article in the Codex:

    https://codex.www.ads-software.com/Template_Hierarchy

    And checking out this handy chart:
    https://www.chipbennett.net/themes/template-hierarchy/

    Thread Starter xmarksthespot

    (@xmarksthespot)

    Josh, thank you for the links, very useful – and your patience.

    I am almost there…

    I now understand when index.php, archive.php etc are applied and in what order.

    In my current theme, index.php provides me with the layout I need for both categories and custom post types such as ‘testimonial2’.

    Currently, it renders a page that displays the name of the category, the description of the category and the posts in that category.

    So I have created is_category, and is_post_type_archive() conditional sections so that index.php can handle both categories and custom post types.

    All is working fine, except that the only thing I am struggling to find now is the field/source for a ‘custom post type description’ (equivalent to a category description) for testimonials2.

    Any ideas? – is there a native field in WordPress? and/or what syntax do I need in index.php to pick up the post description from the testimonials2 pod?

    Plugin Contributor Josh Pollock

    (@shelob9)

    There is no such thing as a custom post type description. I would recommend using a Pods custom settings field to hold this information.

    Thread Starter xmarksthespot

    (@xmarksthespot)

    Thanks for the steer Josh.

    Before I look at that, I note that in the Edit POD Admin UA tab there is a ‘Post Type Description’ which is described as a “short descriptive summary of what the post type is”.

    This would appear to be what I need? – and would avoid setting up a custom field for each and every custom post type I’m planning.

    Any reason why this wouldn’t work? If it’s fine to use, what’s the syntax to get its value into index.php?

    Thread Starter xmarksthespot

    (@xmarksthespot)

    And further to your recommendation…

    I’m probably getting confused on terminology here.

    By “Pods custom setting field” do you mean a ‘custom field’ similar, for example, to pet-name in your tutorial? If so, in my case for testimonials, this would then appear against every testimonial? I just need something that describes what the testimonial pod does that can then be displayed above the testimonials, e.g. ‘Read what previous participants say about Scavenger? the leading team building game on smartphone and tablet’

    Perhaps you can clear up any confusion at my end.

    Plugin Contributor Josh Pollock

    (@shelob9)

    I had no idea that post type description was a part of the post type labels. I love learning new things.

    So, ignore what I said about adding fields. Instead use get_post_type_object, which can return the post type description.

    Thread Starter xmarksthespot

    (@xmarksthespot)

    Perfect. I now have this working. Thanks for your help and glad we both learned something! Win-win!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Some help with PODS design please’ is closed to new replies.