dermotholmes
Forum Replies Created
-
No no luck, I ended up abandoning custom post types completely. This isn’t Custom Post Types UI fault it’s got to do with the way WordPress handles custom post types (CPT’s). I’m pretty much putting CPT’s aside until WordPress reworks them so their not second class citizens.
The solution I’m using now is using the Advanced Custom Fields plugin to show the extra fields I need for different page ‘types’ (even though their all wordpress ‘pages’).
I’m using this in conjunction with wordpress’s native page templates. Advanced Custom Fields can be set to show and hide groups of custom/extra fields depending on the page template selected.
From the user’s perspective picking the page template sort of is like declaring that page to be a specific ‘type’ of page. It’s one extra thing for the user to do but it gets me what I want and lets the urls pan out however you like.
Hope that helps you out a little bit!
Cheers for the response.
You are right about the image, turned out the page and image had the same slug which pantsed it.
Thanks
DCheers, already headed down that path ??
Forum: Fixing WordPress
In reply to: Equivalent to in_category() for custom taxonomy…there’s always an easier way haha
Forum: Fixing WordPress
In reply to: Equivalent to in_category() for custom taxonomyHey jvandelaar, have a read over the WordPress function wp_get_object_terms(), you should be able to do what your after like so:
if( count(wp_get_object_terms( $post->ID, 'action')) > 0 ){ //this post has at least one term in the action taxonomy associated with it, so do stuff... }
Whats going on there?
wp_get_object_terms( $post->ID, ‘action’)
returns an array containing any and all terms that this post has under the ‘actions’ taxonomy. If the post has no terms under the action category you get back an empty array. So, by wrapping this with count() as in…
count(wp_get_object_terms( $post->ID, ‘action’))
you get a the number of terms this post has under the ‘action’ taxonomy.
as long as thats more then zero…
> 0
you know this post has at least one term from the ‘action’ taxonomy on it so you can now do what ever you want in that if block.
Peace out cub scout.
Forum: Fixing WordPress
In reply to: Equivalent to in_category() for custom taxonomyI’m sure there is a more direct way to go about this, however this is what I ended up with for a similar problem.
Assuming your in the loop of the current post you want to check against:
$termsObjects = wp_get_object_terms($post->ID, 'Movies'); //Assuming your post only has one category, if theres more it will return multiple objects in it's return array: $currentCustomCat = $termsObjects[0]->slug; //you can have 'name' instead of 'slug' if that helps too if( $currentCustomCat == "Drama"){ //It matched, do stuff here }
Let me know if you need any explanation of above,
DForum: Plugins
In reply to: [More Fields] [Plugin: More Fields] Feature Request: File Uploadsub & +1 for upload/select from media library feature.
Thanks
Forum: Hacks
In reply to: Using add_image_size With Magic FieldsNever mind, this functionality has now been added as of Magic Fields 1.5.5.
You can now give get_image() a parameter to pick the native wordpress image size/media size such as “media” etc
Forum: Hacks
In reply to: Using add_image_size With Magic FieldsWould anyone be able to provide an example of how to do this?
Looking at the get_image() override params, the only one that seems like it would work for this would be to use the ‘src’ override to reference the correct size you want by splicing the correct file name suffix in, is this the intention of how to do this?
It would be fantastic to use the name of the size, such as johny’s “image-size-small” above if possible.
Is this possible?