Interest in custom post types with custom fields for RedWaves Lite?
Topics related to RedWaves lite theme goes here.

dnuttall

Member Rank
Posts: 18
Joined: Thu Sep 24, 2015 10:30 am

Interest in custom post types with custom fields for RedWaves Lite?

linkPost by dnuttall » Mon Sep 17, 2018 1:44 pm

I've been a grateful user of RedWaves Lite for "a while now". In the past couple days, I decided to explore some plugins and concepts so that I can use custom post types with custom fields attached to custom post types.

The general subject matter for me is music that has several kinds of information that may or may not exist inside the management/control a WordPress site.

So my prototype allows:
  • definition of several post_types, such as public domain songs and copyrighted songs
    independent custom FIELDS for each of the custom post_types
    using only FREE, well mannered WP plugins
    maintenance of a single instance of ./themes/redwaves-lite-child/template-parts/content-single.php
For either of the two custom post types mentioned above, I might want to have custom fields for:
Composer, Lyricist, Year Written.

For copyrighted songs, I would also want to know/add things like:
Primary Artist, Album, Copyright Owner (called "catalog"), Copyright Administrator (of the recording and performing rights)

I might also want to share links to one or more "renditions" which I maintain in a separate database.

And maybe I have music scores or some MIDI or MP3 files of the public domain songs that I can provide for download.


In the end, I can create a category for each post type, easily make lists of posts in each post type and the "beautiful" thing is that the NATIVE WP post type doesn't know or care about the custom post types.

In my way of thinking, THAT is a description of "content management".

And ALL FREE and with RedWaves Lite in control!

I'm not sure if it should take up more space and attention here. Interested people could "PM" me, I guess that could work....but for everyone's "safety" please don't send your email address "in the clear" in response to this posting.

Thanks for reading.
Dave
San Antonio, Texas
User avatar
Asmi Khalil

Site Admin Rank
Posts: 781
Joined: Fri Jun 26, 2015 7:13 am
Display Name: Asmi Khalil
Location: Tunisia

Re: Interest in custom post types with custom fields for RedWaves Lite?

linkPost by admin » Thu Oct 04, 2018 1:20 am

Hi Dave,

Please apologize for the late reply, I was a bit ill so I took two weeks off :oops:

Anyway, WordPress is a very powerful tool. It allows us to create unlimited data types and link between them to create complex catalogs with many filters and sorting options. Unfortunately, it's not easy to do this using a plugin or two. Some coding needs to be done.

I have heard of a plugin that allows you to create custom post types but I never tried it.

Themient.com itself has many custom post types defined like themes, plugins, articles, changelogs..etc. The store page contains both themes and plugins and even though both are two different post types, they share almost the same meta keys (you can create those using the Custom Fields meta box) like version, release date, license.. etc.

If I understand your prototype correctly, here is my approach (from a programming perspective):

A public domain song and a copyrighted song, both are songs so why not defining a single custom post type called song?

To distinguish between them, we can use a post meta-data element (more about post meta here https://designmodo.com/wordpress-post-meta/) which can be attached to a checkbox (on or off) or to a drop-down menu which could be extended to support other types.

Alternatively, we can create a custom taxonomy (more about taxonomies here https://codex.wordpress.org/Custom_Taxonomies) which works similar to WP Categories and Tags (in fact, Categories and tags are WP taxonomies). Taxonomies are good for querying posts but they are hard to work with programmatically because they are user-defined.

Ok, now that we have a way to check the type of a song, we can add assign different meta keys for each type. Each key will have a value. This value can be manually typed or selected using dropdown menus or radio buttons.

For info like artist, album, year, genre. It's better to add them using taxonomies for better sorting and filtering.
I might also want to share links to one or more "renditions" which I maintain in a separate database.
This part is a bit tricky but we can add a whole array as a value for the metadata element which can contain 0 renditions, 1 rendition or many renditions.

On the frontend, we can implement a custom solution that allows us to add an unlimited number of rendition (like the SIdebar adder in RedWaves' Options Panel).

Alternatively, we can have dynamically created keys but with the same prefix like _rendition1, _rendition2, _rendition3 ..etc

If you are wondering why the underscore in the key name? It doesn't make it appear in the Custom Fields editor. Why would I do that? Because these keys are created programmatically and they are expected to have some kind of data so the user shouldn't be able to edit them manually.
And maybe I have music scores or some MIDI or MP3 files of the public domain songs that I can provide for download.
In this case, we can use a third party plugin to manage downloads and add them directly using a shortcode or upload them using the WP media uploader.

For scores, we can output the results using a plugin/shortcode or programmatically fetch the scores using third-party APIs.
In the end, I can create a category for each post type, easily make lists of posts in each post type and the "beautiful" thing is that the NATIVE WP post type doesn't know or care about the custom post types.
Not sure if I understand this part but WordPress itself creates few post types by default including post and page and by default, it will only query "post" posts on the blog page and other archive pages and will ignore any other post type. To display your custom post type posts, you need to create custom template files for them or visit specific URLs.

Please note that custom post type posts still appear in search results by default so you may need to exclude them using a filter.
And ALL FREE and with RedWaves Lite in control!
Better to keep all the backend code in a sperate plugin and only edit RedWaves lite child theme to just add the custom template files.

I'm not sure if it should take up more space and attention here. Interested people could "PM" me, I guess that could work....but for everyone's "safety" please don't send your email address "in the clear" in response to this posting.

I am available for freelance work. I can create you a custom plugin or edit your theme. Email me at admin[at]themient.com if you want to hire me :D
I think there is a world market for maybe five computers. - IBM chairman Thomas Watson, 1943

Who is online

Users browsing this forum: No registered users and 0 guests

It is currently Fri Jul 19, 2019 6:57 pm