• Documentation
  • Support / Community
  • Products
    • Piklist Framework
    • Toolbox
    • Fields and Forms
    • WordPress Helpers
  • Log In
Piklist

Access your account, and post on the Support Forums

Retrieve Password | Register for account

Topic: Add Revisions Support for CPT metadata

Support Home » Topics » Piklist » Add Revisions Support for CPT metadata

Tagged: metadata, revisions

  • This topic has 6 replies, 2 voices, and was last updated 7 years, 10 months ago by luminaire801.
Viewing 6 reply threads
  • Author
    Posts
    • April 1, 2014 at 8:44 pm #1633
      luminaire801
      Member

      Hi guys, been working with Piklist for a while now and it has been wonderful!
      I’m wondering if there is a way to add revisions support for CPT metadata using piklist?
      I found this post but it didn’t really help, http://piklist.com/support/topic/revisions-masterful-coding/

    • April 2, 2014 at 8:39 pm #1637
      Steve
      Keymaster

      Revision support for post metadata is supported in Piklist. If you take a post, change data in some Piklist fields and save, you will see the entry in the wp_post and wp_postmeta tables. However, the UI for viewing this data in the WordPress admin has not been created… yet.

      Here is an article I found on how to implement. We haven’t tested this.

    • April 2, 2014 at 9:03 pm #1638
      luminaire801
      Member

      Hi Steve, is there anything that I should add to the field? I have a CPT called Projects, I have a Title and a Client (piklist field). When I change the Client field, it doesn’t create a revision, but when I edit the Title it creates a revision. And when I edit both and submit, it creates a revision, however when I restore the revision, it doesn’t include the Client metadata.

      The code for the Client Field

      
      piklist('field', array(
      	'type' => 'select'
      	,'field' => 'client'
      	,'supports' => 'revisions'
      	,'label' => 'Choose a Client'
      	,'choices' => piklist(
      		get_users(
      			array(
      				'orderby' => 'display_name'
      				,'order' => 'asc'
      				,'role' => 'Subscriber'
      			)
      			,'objects'
      		)
      		,array(
      			'ID'
      			,'display_name'
      		)
      	)
      ));
      

      The code for the Post Type

      
      //Adds Menu Option for Project
      add_filter('piklist_post_types' , 'project_post_type');
      function project_post_type($post_types){
      	$post_types['project'] = 
      		array(
      			'labels' => piklist('post_type_labels' , 'Project')
      			,'title' => __('Enter title for New Project')
      			,'public' => true
      			,'rewrite' => array(
      				'slug' => 'project'
      			)
      			,'supports' => array(
      				'author'
      				,'revisions'
      				,'title'
      			)
      			,'capability_type' => 'post'
      			,'menu_icon' => plugins_url('piklist/parts/img/piklist-icon.png')
      			,'page_icon' => plugins_url('piklist/parts/img/piklist-page-icon-32.png')
      			,'post_states' => false
      			,'hide_post_row_actions' => array(
      				'trash'
      			)
      			,'hide_meta_box' => array(
      				'slug'
      				,'author'
      			)
      
      		);
      	return $post_types;
      }
      
    • April 3, 2014 at 9:03 am #1639
      Steve
      Keymaster

      I apologize. My comment was misleading. Piklist does support metadata revisions but only if post_title, post_content or post_excerpt are updated… which is the WordPress default. We will eventually tackle this and make it better.

      This plugin seems to do what you want. We have never tried it, and if you do, please let us know how it works. Maybe we can move part of it into Piklist.

    • April 3, 2014 at 8:14 pm #1643
      luminaire801
      Member

      No problem, Steve.

      I will report back to you when I get to test it out.

      Thanks again.

    • April 15, 2014 at 9:49 pm #1650
      luminaire801
      Member

      Hi guys,

      I’m happy to report back that the Custom Field Revisions plugin works.
      It does however, have some bugs. The current custom field revisions have a difference of 1 past revision.
      Also, if you want Custom Field revisions to show when comparing revisions, you need to copy a file in to wp-admin folder.

      Ex.
      Orig post:
      title: Hello
      cf-name: John
      Then I edit cf-name to “Mary”
      Rev1:
      title: Hello
      cf-name:
      Rev2:
      title: Hello
      cf-name: John

      So if you edit it again, it will have..
      Rev3:
      title: Hello
      cf-name: Mary

    • April 15, 2014 at 9:50 pm #1651
      luminaire801
      Member

      I would really love to have this built into Piklist out of the box.

      Thanks! Piklist has been awesome!

  • Author
    Posts
Viewing 6 reply threads
  • You must be logged in to reply to this topic.
Log In

Log in / Register

Register for an Account

Stay up-to-date with Piklist

About

  • Philosophy
  • Privacy Policy
  • Terms of Service
  • Contact Us
  • Register for an account

Resources

  • Community Forums
  • Documentation
  • Tutorials
  • Get involved

Follow Piklist

  • Like us on Facebook
  • Follow us on Twitter
  • Connect on Google +
  • Watch on YouTube

Rate Piklist


If you love Piklist leave us a 5 Star review on WordPress.org.

News

  • Piklist v0.9.9.8 is now available

    September 30, 2019

    In October of 2015, we released v0.9.9 of Piklist. Your help in testing lead to seven(7) m ...

  • Piklist is now on HackerOne

    September 30, 2019

    We built Piklist from the ground up with security as our top priority. While we’ve t ...

  • Read all News
  • Powered by Piklist & WordPress © 2009 – 2022 Piklist LLC.
    This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to the use of cookies. Find out more.