Custom Fields Creator
Admin define Parent ID like Post ID (2 posts)

  1. Hugo
    Posted 3 years ago #

    Hi there, first, i'd like to thank you for this plugin. Just making a test drive for a project and it looks really good!

    I'd like to know if it is possible to choose a Parent ID, of pages where the meta box should appear, rather than the Post ID or the Template, which in my case i don't use much, i rather lock things in place and let clients add new pages and cpt's, ready with just the content to fill.

    Other thing, is the Sortable option, which is available in edit rather than when you are creating a new Meta box.



  2. Hugo
    Posted 3 years ago #

    Got it working!

    What i've done was to create a purpose built Template (i.e. gallery.php) and added an action hook, so every time i add or update a page which is under a certain parent, those children will have their template changed to the one i have set to diplay the CFC Meta Box.

    Like so:
    -Gallery (i.e. ID = 10)
    --Sub Gallery 1
    --Sub Gallery 2
    --Sub Gallery 3

    function save_page_template($post_id) {
      global $post;
      if ($post->post_type=='page' && $post->post_parent == 10){
       update_post_meta($post_id,'_wp_page_template', 'gallery.php');
    add_action('save_post', 'save_page_template', 10, 1);

    So, like this, every new Sub Gallery will display the CFC Meta Box and none other page.

    Maybe there is a more elegant solution for this, but for now it works fine in WP version 3.4.1.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Custom Fields Creator
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.