• 0

DMS 2 Custom Post Types Meta Key / Meta Key Value Not Returning


Question

Posted · Report post

I am trying to post various research studies from different journals using the masonic gallery.  I am using The Custom Post Type UI plugin and have I have defined taxonomies (authors-for the people who wrote the paper, journal-for the periodical it was published in, and topic-for the topic the paper covers). I am trying to display all posts that have the specific journal value for the journal (in this case The Lancet).  But when I enter the meta key slug that my plug produced (journal) and the specific slug for the journal (lancet).  I get no results.  Is this because I am not using the custom post type (papers) in the slug?  I have tried various iterations, but nothing works. The only way I get a result is by selecting post type as "papers"

 

Is there a notation format I am missing for these metakeys?  

 

 

Site is http://cidrzfoundation.flywheelsites.com

page is http://cidrzfoundation.flywheelsites.com/research/lancet/

 

user: flywheel

pw: cidrz14

 

Thanks

Share this post


Link to post
Share on other sites

16 answers to this question

  • 0

Posted · Report post

Hi,

 

If you want to use the Meta Key and Meta Key Value options, you need to add these yourself when adding/editing a post type via the Custom Fields options panel.

 

For example, I have just this moment setup a Movies custom post type, with the following taxonomies, Directory, Actor and Genre. I then create three new movies:

 

1. The Hobbit, which has directory added, actors added and genre set to Fantasy.

2. Aliens, which has direcrtory added, actors added and genre set to Sci-fi, Horror.

3. Blade Runner, which has directory added, actors added and genre set to Sci-fi, epic film.

 

Now on each of these posts, in the custom fields options panel, I click the Enter New link on custom fields, then I added the following:

 

Name Field = Genre

Value = Sci-fi

 

http://cl.ly/image/073X1p3K0S2C

 

and clicked Publish on the post, I did this for each Movie I created, matching the genres for each film.

 

Now I go to DMS visual Editor and in the Masonic Gallery section, I add use these values in the Meta options - http://cl.ly/image/1e3D2S010m3D

 

Now what happens is, the Masonic Gallery section is now only populated with posts that match those custom fields.

 

http://cl.ly/image/3A2t203C1p3m

1 person likes this

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

So the field that the meta key is comparing against is custom fields. Is this native in wordpress?  I am asking because I don't think I need a custom type plugin if it is.

 

Thanks,

seth

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

For me personally, I would probably still use the custom post type plugin, as for me it makes managing them multiple posts easier. But that is entirely up to you.

 

The Custom Fields options is native to WordPress and isn't in the Custom Post Types UI plugin, you can find the custom field options panel under both Wordpress Admin Dashboard > Pages/Posts/Custom Post Type. If you do not see it at first, then its probably not enabled, to enable it, when on a Page, Post or Post Type, go to the top right hand corner of your screen and you see the Screen Options, click that and a number of options appear, just check the Custom Field checkbox, then the options panel will appear.

1 person likes this

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

I did enable it, and it works well when the field has only one value.  But how do you handle multiple values (in your example actors). I am separating each value with a comma and a space. For example custom field Actor:  Name1, Name2, Name3  Then I am quering for name 3 and getting no value in the masonic gallery. Is there a different way to enter customer fields?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Thanks, Danny.  I figured this out.  There is not a simple way as I can see it.  I have just entered a custom field for each author.  The big studies take ages to enter.  I have to think there is an easier way.  Thanks for your help.  

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

I will mention this to our developers and see if it is something we can add in the future.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Cheers, Danny.  Thanks again for your help.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

No problem.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Thanks Danny,

 The salient point is that you MUST be on the post page in WP and then TURN ON CUSTOM FIELDS in the SCREEN OPTIONS in the Upper Left of the page.

Then everything else Danny said at the beginning will then make total sense!

Cheers,

~mar

1 person likes this

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Thanks for the input Mar ;)

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Hello Danny, what if I want to customize the filter?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Hi sward,

 

I am not entirely sure what you're referring to. However, as this topics questions, has been answered. Would it be possible for you to create your own topic please.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Danny,

Sorry to bring this post back to life but I've a question regarding the process you outlined.

 

For example, I have just this moment setup a Movies custom post type, with the following taxonomies, Directory, Actor and Genre. I then create three new movies:

 

1. The Hobbit, which has directory added, actors added and genre set to Fantasy.

2. Aliens, which has direcrtory added, actors added and genre set to Sci-fi, Horror.

3. Blade Runner, which has directory added, actors added and genre set to Sci-fi, epic film.

 

Now on each of these posts, in the custom fields options panel, I click the Enter New link on custom fields, then I added the following:

 

Name Field = Genre

Value = Sci-fi

 

 

In CPT UI I create a Post Type (Dogs).

Then, still in CPT UI, I create a Taxonomy term (Poodle), attaching it to the Post Type (Dogs) I just created.

Then, still in CPT UI, I edit the Post Type (Dogs) settings to include the new taxonomy (Poodle) as 'built in'.

 

In the WP Posts / Categories editor, I add categories for both the new Post Type (Dogs) and Taxonomy (Poodle).

 

Then I create a new post, using the new Post Type (Dogs) I just made.

In that editor I check the newly made Post Type (Dogs) and taxonomy (Poodle) categories.

I also add the new taxonomy term (Poodle) to the Name field in the Custom Fields option.

 

Now, in your example you have the values I bolded in your quote above.

Where did they come from? Something you did in CPT UI?

Or, do you just make them up when you get to the Custom Fields section of the Post Type post? 

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

The Fantasy etc... were categories(genre) I added to the movies post type as far as I can remember.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

So you created the categories via the main WP Post/Categories area and then added them as taxonomies to the Movies CPT via the CPT UI editor?
 

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Ah no, sorry I have just viewed my test site where I had this setup.

The Genre and Fantasy, Sci-Fi etc.. were added the custom fields option like the image in my answers shows - http://cl.ly/image/073X1p3K0S2C

 

https://cloudup.com/cQhdwbPemgo

1 person likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now