normadize
Forum Replies Created
-
Forum: Plugins
In reply to: [Custom Content Type Manager] equally good taxonomy manager plugin?Thanks. I’ll do some testing to see. At first glance, it appears to work. At least it stops altering the meta field and also no longer parses when fetching it.
I know what you’re saying regarding multiple values. I also mentioned it a few messages back. I’m still puzzled why you are modifying that db entry given you are actually using another entry (the
_pods_{field_name}) and a separate db table. At this point I want to keep some compatibility between Pods and CCTM as I’m switching between them while testing, but if I decide on Pods only then I may allow it to mess with the native WP calls.Are you also looking at the alpha/beta releases of WP to prepare for changes in the WP API?
Also, check your email.
Forum: Plugins
In reply to: [Custom Content Type Manager] equally good taxonomy manager plugin?I think you mean ‘post’ instead of ‘pods’ by looking at the code. I don’t mind the _pods_{field_name} meta. What I do mind is Pods altering the existing {field_name} — it turns it from a 1 row holding a string into 3 rows in wp_postmeta. It doesn’t look like that’s needed since you’re using _pods_{field_name} which hold the same information, and a separate table with the relations.
But if I run
pods_no_conflict_on( 'post' );on init, will the Pods GUI still work normally? That would be great.Forum: Plugins
In reply to: [Custom Content Type Manager] equally good taxonomy manager plugin?@scott, thanks but I had already disabled that. I was asking about the class method and filter/action hooked into saving a post. In short, I have a custom field in wp_postmeta called
person_ids. This has a string meta_value of["123","234","345"](a json array string). This was previously created by CCTM as a relationship field. I also have the same custom field name defined in Pods (CCTM is disabled) also as a relationship field. Pods is using a different table so should normally ignore this field. It also inserts a custom field called “_pods_person_ids” in the wp_postmeta which has a serialized version of the same array as meta_value.When saving the post to which this is assigned, Pods is altering the
person_idsmeta, and not only that, it wipes it and creates 3 different rows in the DB, each having the meta_value equal to 123, 234, 345. I’d like to disable that (is it actually necessary given you have your own meta in wp_postmeta and a different table?)@everett, I think I was mistaking .. it is actually covered by the select and multi-select fields. For relationship fields it’s true CCTM is pretty flexible. It requires configuration through php code though which can put users off a bit. Pods allows some of that in the gui (direct SQL WHERE/ORDER/GROUP code).
One feature I’d like to see in CCTM is autocomplete as an alternative/additional way for adding values from a list – in addition to dropdown, mulit-select or your ajax selector. Typing a few letters to get a list of matching values is many times so much more efficient and faster than scrolling and selecting from a very long list.
Forum: Plugins
In reply to: [Custom Content Type Manager] equally good taxonomy manager plugin?@scott, thanks. I think you mean ‘parents.friends’ in the 2nd example. I was was interested in which class method is modifying the wp_postmeta table as I described above. Currently, a relationship field that was previously a string of N IDs is turned into N different rows. Which class method and which filter/action hook is doing that in Pods? I’d like to disable that (it’s unnecessary).
@everett, I’m not mixing Pods with CCTM. I am now only testing each in turns, keeping only one active at at time. Since both these plugins claim that they are using the native WP DB schema for custom fields and post types, then I’d like to use them for their GUI to create and insert stuff, but parse (mostly read) the data from the DB myself using the native WP API. I understand that relationship fields are an exception and some custom way of storing them is needed (although I would have still opted for keeping the native WP storage format of multiple rows rather than json array string or a different table — and I’m aware of the headaches of having an array of values as multiple rows in wp_postmeta).
I could have a small class method of my own for retrieving relationship fields, checking for a few known return types of
get_post_meta()in case I have either CCTM or Pods enabled, or none at all. Any other custom field type should be unaffected — although Pods does affect it, which is why I’m looking to disable its filters/actions in my own plugin code (I can use the Pods/CCTM API separately if I so wish, but I want my plugin to be independent).You both have written really great plugins, with good code and docs.
Congrats!
p.s. CCTM could implement custom list for relationships (Pods has this) while Pods could consider implementing custom fields types that are standalone and can be assigned to multiple post types rather than having to define custom fields for each post type (CCTM has this).
Forum: Plugins
In reply to: [Custom Content Type Manager] equally good taxonomy manager plugin?@scott, I tried out Pods just now and defined the same post types and custom fields that I previously defined with CCTM. I notice that Pods hooks a filter into
get_most_meta()by default namelyPodsMeta::get_post_meta().This was unexpected, and undesired, because a call to
get_post_meta()on a custom relationship field that was previously defined with CCTM, which holds a string like["263","264","268"]as themeta_value, now returns an array of WP_Post objects, rather than just the actual string value.Also, when saving the post which holds this custom field, the meta_value which was previously one row in the DB holding the above string as meta_value, was suddenly split into 3 rows, each holding one ID as meta_value. This must be the result of another action hook from Pods. What class method is actually doing this DB change?
I’m puzzled about this behavior too, since Pods is using a different table wp_podsrel for relationships, and I can see the 3 rows defined there, so why alter the native wp_postmeta table and change the output structure of wp_get_meta()?
That would prompt me to change my plugin code. I didn’t want to use the CCTM API to parse the content of relationship fields as I’m trying to have my code as independent as possible from other plugins. I guess I can just remove the filter before calling get_post_meta() but now I also have to revert the
wp_postmetaDB entries back to the old version.Are other hooks added by default by Pods regarding fetching or updating/inserting custom field values or custom post type content? Would save me some time digging into the Pods docs or code, as my Plugin is almost entirely based on the native WP API for those operations, and I’m assuming that there are no additional action or filter hooks.
It may be down to preference but I think it’s best not to hook filters into these native functions by default given that you’re already providing a pretty full blown separate API. That way, people who want to use and depend on your API can still do so, but those who don’t would at least not end up with broken code when activating or deactivating your plugin.
Cheers.
p.s. Also, there is a bug in Pods too (I’ll report it properly): for a relationship field that uses a dropdown list to choose, the title shown in the dropdown is not applying the
the_titlefilters; it shows the raw title which in my case contains 3 versions for 3 different languages (qTranslate plugin). It however does apply thethe_titlefilters if it’s a multiple select using checkboxes.Forum: Plugins
In reply to: [Custom Content Type Manager] equally good taxonomy manager plugin?Forum: Plugins
In reply to: [Custom Content Type Manager] equally good taxonomy manager plugin?Thanks Scott. It seems I need to do some hacking to add a text field/description for a combination of assigned taxonomies.
I take it that you store Relationships for custom taxonomies in a custom DB table. I could implement a description field for any assigned taxonomy pairings or relationship fields of a post by using a normal text custom field whose meta value would be stored respecting a specific format, e.g.
t1234,t2351,f345 At this time Person Y was the director of Company Xwhere t1234, t2351 and f345 are the IDs of two taxonomy members assigned and custom field assigned to the post. Basically, any number of IDs separated by a comma, terminated by a space would indicate the combination of taxonomies and/or custom fields that the text following the space is a description of. The letter signal the type (table in the db).
Some jQuery and javascript would solve the above, e.g. display a list of the taxonomies and fields detected as assigned in the edit screen, allowing the user to click and select multiple of them then write a description and build the meta value upon post submission.
CCTM already has a few Ajax snippets that do that for relationship fields (and I suppose Pods does too), but in this case Ajax is not needed as we don’t need to query the db; the info is on screen.
I can implement the above as an add-on to CCTM or Pods, without touching their code. It’ll be another widget in the edit screen.
I need this sort of thing to generate an automatic HTML table based on the assigned taxonomies and relationships, so just a static description of a relationship field (filled in when the field was created, like WP does for categories) wouldn’t work.
If you guys have a better idea of how to implement this other than the above approach, then by all means, I’m all ears (well, eyes). If yes, and if the CCTM API or Pods API already provide some features to speed up the above implementation, then please do tell which and point me to the API docs for it or some code entry points where it is used.
[ the above is also for my own reference, sorry for the slight off-topic ]
Forum: Plugins
In reply to: [Custom Content Type Manager] equally good taxonomy manager plugin?@scott, that sounds and looks quite interesting. Are those relationship objects available as custom fields for Taxonomies as well? For instance, would I be able to define, say, a relationship custom field for a taxonomy member pointing to a custom defined list (similar to your 1st screenshot)?
What about my usage case above (the Company/Person/Position + text field issue)? I’d love an answer about it and whether I can have a custom field (e.g. description) for a combination of relationships.
@everett, I like your CCTM implementation of relationships and the fact that you store them in the wp_postmeta table — it allows using the WP API to write and read it, even though you need a custom API to actually do stuff with it afterwards. I have to admit, I was in such a rush with my project, I parsed them in the code without knowing there is an accessor class for them (I just preg_split() the IDs into an array and used my own code from there).
Forum: Plugins
In reply to: [Custom Content Type Manager] equally good taxonomy manager plugin?@scott, are you monitoring the WP forums for all occurrences of Pods? 🙂
Many thanks for that spreadsheet! Very, very useful!
Regarding the relationship field. CCTM has a really awesome relationship field which I have been using. It seems hard to top that but I guess not impossible. However, what i was describing above is something a bit different.
Suppose I have two custom taxonomy names, “Companies” and “Persons”. Suppose I have Company X and Person Y as taxonomies belonging to those. I’m assigning these two to a post P. I would like to have a comment field to use to describes the relationship between the pair XY and the post P, e.g. “at the time of this writing, Person Y was the director of Company X”.
I can have another taxonomy called “Positions” and have “Director” being a member and assign it to the post as well but that wouldn’t work as intended since the post has multiple persons, multiple companies and multiple positions; it could be done with some extended relationship fields to link XY to P and Director. However, I am ultimately interested in a text field to write a short description of such a relationship, besides the relationship itself (then I could also do away with the Positions taxonomy in this particular case).
This sort of thing then makes automation really efficient, and not only. Haven’t dug enough in Pods to see how much of this it can do, but would certainly love to see custom fields for taxonomies in CCTM, extended with custom fields that can relate to taxonomies, not just to posts.
p.s. Regarding Pods, I recall it created a new table as soon as I added a custom taxonomy and that I couldn’t query it using the WP API. Are you sure custom taxonomies created by Pods are inserted in the wp_term* mysql tables and that I should be able to use the WP API for terms e.g. get_the_term_list(), wp_set_object_terms() etc?
Thanks once again for the info.
Forum: Plugins
In reply to: [Custom Content Type Manager] equally good taxonomy manager plugin?If it looks like I can add custom-fields to taxonomies cleanly, then I’ll give it a go once a project comes in that requires it.
I have a large project that requires it. Maybe we can discuss about it elsewhere?
Maybe I am mistaking, but I seem to recall that Simple Taxonomy doesn’t use the WP tables at all, i.e. the custom taxonomies do not appear in wp_terms along with the other native ones (tags, categories, etc), which then turns it into a hassle. There is no need for custom tables to store taxonomy definitions; that’s why the wp_terms and wp_term_taxonomy tables are for … I haven’t dug further as it looked like the WP API couldn’t be used for it (I need custom taxonomies in the code, not just in the GUI).
There is an interesting plugin out there called CPT-onomies, which attempts at using custom post types as taxonomies. I’m a bit weary doing that as WP is already slow to begin with, but it would allow for some interesting flexibility.
I’m interested not only in custom fields for taxonomies, but also in custom fields for taxonomy relations, i.e. when I assign two different taxonomies to a post, say “institution 1” and “person 1”, then I’d like to have a custom field for that particular pair in relation to the post, e.g. a comment field.
WP is abhorring and I get frustrated every single time I need to code using its so called API. It started as a script kiddie project, written using global functions with thousands of arguments and global variables everywhere, and now it can’t escape that horrible mess they call a “code architecture” as they need backwards compatibility and it somehow makes it easier for other script kiddies to create plugins which look just like WP, i.e. tons of html code intertwined with PHP code using global functions and global vars. Makes me cringe.
Forum: Plugins
In reply to: [Custom Content Type Manager] equally good taxonomy manager plugin?(see a recommendation for CCTM at the end)
I did see that you recommend it, but
Simple Taxonomyuses custom mysql tables, i.e. different than wp_terms, wp_term_relationships, etc. I’m not sure why this was done — perhaps the plugin is older than WP 3.0 when WP introduced custom taxonomies — but I don’t like it as it makes things non-standard. I’d rather use the native WP tables and API for custom taxonomies.Simple Taxonomyalso makes it a pain wrt to labels … you have to type them all in by hand, rather than expanding the raw name.I had a look at
Custom Post Type UIwhich has a manager for custom taxonomies as well … hasn’t been updated in a while but still works fine with WP 3.5.1. It’s missing capability managementPods - Custom Content Types and Fieldsis a very powerful plugin, with a lot of functionality, which can also add custom fields for taxonomies — this is actually quite neat (you can have a taxonomy for “institutions” let’s say, each with fields for url, address, etc, and then assign them to posts). But it too uses custom tables and a custom API 🙁 … to its credit though, the author claims to provide some good documentation for it.I may end up writing my own for the time being. I’m not fond of the idea of adopting a plugin with a custom API and db schema because I never have a guarantee that the author will maintain it as WP evolves. Using the native WP API and DB schema at least makes it easier to fix/patch and maintain it myself.
If you implement custom taxonomies in CCTM, it would be great if you added custom fields to them as well. You will have to use a custom db schema but only for taxonomy meta, using the native WP API and schema for everything else. Maybe have a look at Pods to get inspired.
Cheers and keep up the good work!
EDIT: At first I though Oshouki is the plugin author (asking me to write to the author of another plugin to fix a code conflict).
Thanks for the fix!
However, I do not have any custom/extra columns in the
postsorpostmetatables in the database. The columnpost_typeis a native column. I have only registered custom post types.Yes, just replace
_()with__()— note the double underscore.Interesting how this one escaped the developer – unless he doesn’t have display errors enabled? but that would be against the principles of developing 🙂
I’m sure he’ll fix it soon.
Thanks for trying to help, but it doesn’t work. The fact that there is “cat=8” triggers the query to set
$wp_query->is_hometofalse. The solution I posted works, but is ugly (it forces the flag back to true), and I think this is all unexpected behaviour, if not a bug.But that doesn’t help the problem, which is that the posts are seen as NOT being in “home”, i.e. is_home() returns false. The fact that “cat=8” is used triggers the query to have is_home = false, instead of true.