Jump to content

Archived

This topic is now archived and is closed to further replies.

sethoof

Custom Post Types Meta Key / Meta Key Value Not Returning

Recommended Posts

sethoof    3
sethoof

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
Danny    1,327
Danny

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

  • Like 1

Please search our forums, before posting!

Share this post


Link to post
Share on other sites
sethoof    3
sethoof

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
Danny    1,327
Danny

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.

  • Like 1

Please search our forums, before posting!

Share this post


Link to post
Share on other sites
sethoof    3
sethoof

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
sethoof    3
sethoof

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
Danny    1,327
Danny

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


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
sethoof    3
sethoof

Cheers, Danny.  Thanks again for your help.

Share this post


Link to post
Share on other sites
Danny    1,327
Danny

No problem.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
mars+    1
mars

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

  • Like 1

Share this post


Link to post
Share on other sites
Danny    1,327
Danny

Thanks for the input Mar ;)


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
Danny    1,327
Danny

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.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
dario+    20
dario

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
Danny    1,327
Danny

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


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
dario+    20
dario

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

  • Similar Content

    • MissT
      By MissT+
      Hi there, the Filter By option within the Masonic section isn't working when a custom post type and custom category is selected.  If you swap to normal posts and categories then it works but sadly not with custom post types and custom categories.
      All posts are shown but when you click on the categories all posts disappear even though posts do have these categories. When you click All all the posts come back. I've tried this on two different websites with the same result.
      Many thanks in advance.
    • Lisa Haran
      By Lisa Haran+
      Hi 
      I have a map here http://www.iloveoffset.com/maps/
      I want to add several pointer locations to the map, but when I do they do not appear.
      On this map there are 2 pointer locations and as you can there is only one visible.
      Earlier today I added 7 and could only see 4 so there is something odd going on.
      My theme is up to date
    • clj182
      By clj182+
      Hello,
      I've been having trouble unlocking the template section for past couple of weeks. When I try clicking nothing happens. 
      I've deleted my custom css and removed plugins. Im down to having only the following plugins:
      Akismet
      Contact Form 7
      DMS Professional Tools
      Pagelines Updater
      WooCommerce
      It was working fine before i have no idea what's going on with it.
    • flourishdesignstudio
      By flourishdesignstudio
      My DMS 2 site http://www.heart-stone.com/ will not save any new custom css... I can still edit templates and publish those but any custom css that I enter never saves.
      All WP files, themes, and plugins are up to date. 
      Any thought about what might be causing this?
    • flourishdesignstudio
      By flourishdesignstudio
      Is there a way to edit the custom CSS via FTP? I know I can edit the custom code in the Chrome editor but is there a file path I can use to find and edit the CSS directly from our FTP?
      Thanks in advance for the help!
×