Viewing 4 reply threads
  • Author
    Posts
    • #5834
      irene
      Member

      I was wondering if it is possible to use a field-relate (shown as select) in an add-more.

      I would like to have the layout of the advanced relate but instead of creating new posts,
      I would like to pull in existing posts from another post type with a select type field.

      Thanks,
      Irene

    • #5841
      Steve
      Keymaster

      @irene– Not sure if you need a relate field for this. We have something similar in the Piklist demos:

      Add new Demo > Add more’s Tab > Two levels sub tab > “Content Section (Grouped)” field.

      Check it out and let me know if it works for you.

    • #5842
      irene
      Member

      Hello Steve,
      Maybe I could use that…
      Thinking and re-thinking…
      Hope I can explain…
      I have 2 cpt’s
      1. Dogs
      2. Litters
      In the Dogs CPT all dogs are entered (bitches, dogs and pups with category male ore female
      In the Litters cpt, create a new litter => Choose dam, from dogs-cpt, category female
      Choose sire, from dogs-cpt, category male
      These 2 form the parents.
      Then below that the pups (children, need to be related to dam and sire, and are siblings. These pups are also coming from Dogs cpt- resp, female or male….

      I can not find anywhere if when I use an add more the items chosen are directly related to the post.
      New to all this but willing to learn 🙂
      Hope you can follow me and if you can advise me on how to achieve this…

      Thanks,
      Irene

    • #5873
      irene
      Member

      Excuse me for bothering you again…
      Trying to get the following:
      I would like to render the selected post on the post edit page and used the following

      /*
      Title: Nest Informatie
      Post Type: nesten
      Status: auto-draft
      Collapse: false
      Meta box: false
      */
      
      piklist('field', array(
      	'type' => 'group'
         ,'template' => 'field'
        
         ,'fields' => array(
          
      	
      	array(
        'type' => 'select'
        ,'field' => 'sire'
        ,'label' => 'Sire:'
        ,'columns' => 6
        ,'choices' => piklist(
        					get_posts(
      					   array(
        	    'sort_order' => 'ASC'
      	   ,'post_type' => 'hond'
      	   ,'post_status' => 'publish'
      	   ,'tax_query' => array(
      		array(
      			'taxonomy' => 'geslacht'
      			,'field'   => 'slug'
      			,'terms'   => 'reu'  ))
          )
      	 ,'objects'
      	)
      	
      	
      	,array(
            'ID'
            ,'post_title')
        
        ) )

      and the following on the next page:

      /*
      Title: edit nesten
      Post Type: nesten
      Status: publish
      Collapse: false
      Meta box: false
      */
      ?>
      <?php $value_sire=get_post_meta(get_the_ID(), 'sire', true);
      			$sire_post_id= $value_sire['ID'];
      			$sire_permalink= get_permalink($sire_post_id);
      			$sire_name= get_post_meta($sire_post_id, 'sire',true);
      			?>
                  
                  <ul>
                  <li> <a href=" <?php echo $sire_permalink; ?>" <?php echo $sire_name; ?></a></li>
                  </ul>

      Both nothing shows up on the second page… I am missing something…

      Have been reading this post select-box-for-displaying-posts but can not figure it out…

    • #5878
      Steve
      Keymaster

      @irene– I’m not sure I understand the questions. Can you post screenshots of the pages you want to show this data on?

Viewing 4 reply threads
  • You must be logged in to reply to this topic.