Forum Replies Created

Viewing 15 posts - 1 through 15 (of 21 total)
  • Author
    Posts
  • in reply to: Using get_terms to pull in menus into select field #2359
    tuckerjoenz
    Member

    Thanks Marcus! I do too LOL 🙂

    in reply to: Using get_terms to pull in menus into select field #2356
    tuckerjoenz
    Member

    @Marcus that is PERFECT! Thank you you! 🙂

    in reply to: Using get_terms to pull in menus into select field #2354
    tuckerjoenz
    Member

    @Marcus thanks but that didn’t seem to work.

    tuckerjoenz
    Member

    that’s what I thought. I was hoping there was a simple way to add customization to the select for Programs for the client, but I think we will have to just go with a standard select for now. Thanks Jason!

    tuckerjoenz
    Member

    @Jason not a problem. What I want is that Program select to be a taxonomy that can be changed by an admin. Right now I have added a select dropdown. What I don’t want is the taxonomy to be part of the post type in general, just to be associated with the add more group. Here is the entire CPT. Let me know if that helped 🙂

    <?php
    /*
    Title: Partnerss
    Post Type: partnerss
    Order: 13
    Meta Box: false
    Collapse: false
    */
    ?>
    
    <?php
    
      piklist('field', array(
        'type' => 'file'
        ,'field' => 'a_partner_logo'
        ,'scope' => 'post_meta'
        ,'label' => __('Partner Logo')
        ,'description' => 'Pixel dimensions...'
        ,'options' => array(
          'basic' => true
        )
      ));
    
      piklist('field', array(
        'type' => 'text'
        ,'field' => 'a_partner_url'
        ,'label' => 'Partner URL'
        ,'attributes' => array(
          'class' => 'regular-text'
          ,'placeholder' => 'http://'
        )
        ,'on_post_status' => array(
          'value' => 'lock'
        )
      ));
    
      piklist('field', array(
        'type' => 'text'
        ,'field' => 'a_donation_url'
        ,'label' => 'Donation URL'
        ,'attributes' => array(
          'class' => 'regular-text'
          ,'placeholder' => 'http://'
        )
        ,'on_post_status' => array(
          'value' => 'lock'
        )
      ));
    
    // REPEATED FIELDS
    
      piklist('field', array(
        'type' => 'group'
        ,'field' => 'a_grant'
        ,'add_more' => true
        ,'label' => __('Grants')
        ,'description' => 'Add a grant by clicking the blue plus button.'
        ,'fields' => array(
    
          array(
            'type' => 'checkbox'
            ,'scope' => 'post_meta'
            ,'field' => 'a_active_grant_status'
            ,'label' => 'Active Grant'
            ,'choices' => array(
              'show' => 'Show on partner page?'
            )
            ,'on_post_status' => array(
              'value' => 'lock'
            )
          )
    
          ,array(
            'type' => 'datepicker'
            ,'scope' => 'post_meta'
            ,'field' => 'a_grant_year'
            ,'label' => 'Grant Year'
            ,'attributes' => array(
              'class' => 'text'
              ,'placeholder' => 'Pick a Date'
            )
            /*,'options' => array(
              'dateFormat' => 'M, yyyy'
              ,'firstDay' => '0'
            )*/
          )
    
          ,array(
            'type' => 'text'
            ,'scope' => 'post_meta'
            ,'field' => 'a_grant_amount'
            ,'label' => 'Amount Awarded'
            ,'attributes' => array(
              'class' => 'regular-text'
              ,'placeholder' => 'Amount Awarded'
            )
            ,'on_post_status' => array(
              'value' => 'lock'
            )
          )
    
    //TAXONOMY?
          ,array(
            'type' => 'select'
            ,'scope' => 'post_meta' // Not used for settings sections
            ,'field' => 'a_grant_amount_range'
            ,'value' => 'option1' // Sets default to Option 1
            ,'label' => 'Amount Range'
            ,'attributes' => array(
              'class' => 'text'
            )
            ,'choices' => array(
              'option1' => NULL
              ,'option2' => 'Less than $100,000'
              ,'option3' => '$100,000 - $200,000'
              ,'option4' => '$200,000 - $300,000'
              ,'option5' => '$300,000 - $400,000'
              ,'option6' => '$400,000 - $500,000'
              ,'option7' => '$500,000 and more'
            )
          )
    
          ,array(
            'type' => 'text'
            ,'scope' => 'post_meta'
            ,'field' => 'a_grant_location'
            ,'label' => 'City'
            ,'attributes' => array(
              'class' => 'regular-text'
              ,'placeholder' => 'Grant Location'
            )
            ,'on_post_status' => array(
              'value' => 'lock'
            )
          )
    
    // TAXONOMY FIELDS
    
          ,array(
            'type' => 'select'
            ,'scope' => 'post_meta' // Not used for settings sections
            ,'field' => 'a_grant_region'
            ,'value' => 'option1' // Sets default to Option 1
            ,'label' => 'Region'
            ,'attributes' => array(
              'class' => 'text'
            )
            ,'choices' => array(
              'option1' => NULL
              ,'option2' => 'North America'
              ,'option3' => 'South America'
              ,'option4' => 'Europe'
              ,'option5' => 'Asia' 
              ,'option6' => 'Africa'
              ,'option7' => 'Australia'
            )
          )
    
          ,array(
            'type' => 'hidden'
            ,'scope' => 'post_meta' // Not used for settings sections
            ,'field' => 'a_grant_associated_arcus_type'
            ,'label' => 'Type'
            ,'attributes' => array(
              'class' => 'text'
            )
          )
    
          ,array(
            'type' => 'select'
            ,'scope' => 'post_meta' // Not used for settings sections
            ,'field' => 'a_grant_associated_arcus_program'
            ,'value' => 'option1' // Sets default to Option 1
            ,'label' => 'Program'
            ,'attributes' => array(
              'class' => 'text'
            )
            ,'choices' => array(
              'option1' => NULL
              ,'option2' => 'Option 1'
              ,'option3' => 'Option 2'
              ,'option4' => 'Option 3'
            )
          )
    
          ,array(
            'type' => 'editor'
            ,'scope' => 'post_meta'
            ,'field' => 'a_grant_description'
            ,'label' => 'Grant Description'
            ,'options' => array (
              'media_buttons' => false
              ,'teeny' => false
              ,'textarea_rows' => 5
              ,'drag_drop_upload' => false
            )
          )
        )
      ));
    
    /*
    
      piklist('field', array(
         'type' => 'datepicker'
         ,'field' => 'arcus_date'
         ,'label' => 'Grantee Year'
         ,'description' => 'Grantee Year'
         ,'attributes' => array(
           'class' => 'text'
         )
        ,'options' => array(
           'dateFormat' => 'M, yyyy'
           ,'firstDay' => '0'
        )
      ));
    
    */
    
      echo '<h3>Related Partners</h3>';
    
      piklist('field', array(
        'type' => 'post-relate'
        ,'scope' => 'Partners'
        ,'template' => 'field'
      ));
    
      echo '<h3>Related Stories</h3>';
    
      piklist('field', array(
        'type' => 'post-relate'
        ,'scope' => 'stories'
        ,'template' => 'field'
      ));
    
      echo '<h3>Related News</h3>';
    
      piklist('field', array(
        'type' => 'post-relate'
        ,'scope' => 'post'
        ,'template' => 'field'
      ));
    
      echo '<h3>Related Publications</h3>';
    
      piklist('field', array(
        'type' => 'post-relate'
        ,'scope' => 'publications'
        ,'template' => 'field'
      ));
    tuckerjoenz
    Member

    @Jason my bad, yes let me show you what I’m trying to do.

    https://www.evernote.com/shard/s42/sh/39c88564-66e5-4da6-bb84-e02d59d2a3c2/f9fb80bc01713627feb80bebd7bf4acb

    That program select I want to make as a taxonomy to be able to be added to and changed. Is this possible? Right now I have just a select hard coded. Here is that code:

    // REPEATED FIELDS
    
      piklist('field', array(
        'type' => 'group'
        ,'field' => 'a_grant'
        ,'add_more' => true
        ,'label' => __('Grants')
        ,'description' => 'Add a grant by clicking the blue plus button.'
        ,'fields' => array(
    
          array(
            'type' => 'checkbox'
            ,'scope' => 'post_meta'
            ,'field' => 'a_active_grant_status'
            ,'label' => 'Active Grant'
            ,'choices' => array(
              'show' => 'Show on partner page?'
            )
            ,'on_post_status' => array(
              'value' => 'lock'
            )
          )
    
          ,array(
            'type' => 'datepicker'
            ,'scope' => 'post_meta'
            ,'field' => 'a_grant_year'
            ,'label' => 'Grant Year'
            ,'attributes' => array(
              'class' => 'text'
              ,'placeholder' => 'Pick a Date'
            )
            /*,'options' => array(
              'dateFormat' => 'M, yyyy'
              ,'firstDay' => '0'
            )*/
          )
    
          ,array(
            'type' => 'text'
            ,'scope' => 'post_meta'
            ,'field' => 'a_grant_amount'
            ,'label' => 'Amount Awarded'
            ,'attributes' => array(
              'class' => 'regular-text'
              ,'placeholder' => 'Amount Awarded'
            )
            ,'on_post_status' => array(
              'value' => 'lock'
            )
          )
    
    //TAXONOMY?
          ,array(
            'type' => 'select'
            ,'scope' => 'post_meta' // Not used for settings sections
            ,'field' => 'a_grant_amount_range'
            ,'value' => 'option1' // Sets default to Option 1
            ,'label' => 'Amount Range'
            ,'attributes' => array(
              'class' => 'text'
            )
            ,'choices' => array(
              'option1' => NULL
              ,'option2' => 'Less than $100,000'
              ,'option3' => '$100,000 - $200,000'
              ,'option4' => '$200,000 - $300,000'
              ,'option5' => '$300,000 - $400,000'
              ,'option6' => '$400,000 - $500,000'
              ,'option7' => '$500,000 and more'
            )
          )
    
          ,array(
            'type' => 'text'
            ,'scope' => 'post_meta'
            ,'field' => 'a_grant_location'
            ,'label' => 'City'
            ,'attributes' => array(
              'class' => 'regular-text'
              ,'placeholder' => 'Grant Location'
            )
            ,'on_post_status' => array(
              'value' => 'lock'
            )
          )
    
    // TAXONOMY FIELDS
    
          ,array(
            'type' => 'select'
            ,'scope' => 'post_meta' // Not used for settings sections
            ,'field' => 'a_grant_region'
            ,'value' => 'option1' // Sets default to Option 1
            ,'label' => 'Region'
            ,'attributes' => array(
              'class' => 'text'
            )
            ,'choices' => array(
              'option1' => NULL
              ,'option2' => 'North America'
              ,'option3' => 'South America'
              ,'option4' => 'Europe'
              ,'option5' => 'Asia' 
              ,'option6' => 'Africa'
              ,'option7' => 'Australia'
            )
          )
    
          ,array(
            'type' => 'hidden'
            ,'scope' => 'post_meta' // Not used for settings sections
            ,'field' => 'a_grant_associated_arcus_type'
            ,'label' => 'Type'
            ,'attributes' => array(
              'class' => 'text'
            )
          )
    
          ,array(
            'type' => 'select'
            ,'scope' => 'post_meta' // Not used for settings sections
            ,'field' => 'a_grant_associated_arcus_program'
            ,'value' => 'option1' // Sets default to Option 1
            ,'label' => 'Program'
            ,'attributes' => array(
              'class' => 'text'
            )
            ,'choices' => array(
              'option1' => NULL
              ,'option2' => 'Option 1'
              ,'option3' => 'Option 2'
              ,'option4' => 'Option 3'
            )
          )
    
          ,array(
            'type' => 'editor'
            ,'scope' => 'post_meta'
            ,'field' => 'a_grant_description'
            ,'label' => 'Grant Description'
            ,'options' => array (
              'media_buttons' => false
              ,'teeny' => false
              ,'textarea_rows' => 5
              ,'drag_drop_upload' => false
            )
          )
        )
      ));
    tuckerjoenz
    Member

    I’m sorry I didn’t explain that well. I do see Grant Name in place of Title if I create new but the imported name is what still comes up as a series of numbers. I think I may have to go and change those in PHPMyAdmin. Thank you!

    Attachments:
    You must be logged in to view attached files.
    tuckerjoenz
    Member

    @Steve I tried your suggestion too. I’m not getting the title to show up. Here is my code and I commented out the above code Jason recommended.

    functions.php

    add_filter('piklist_post_types', 'grantee_post_type');
     function grantee_post_type($post_types)
     {
      $post_types['grantee'] = array(
        'labels' => piklist('post_type_labels', 'Grants')
        ,'title' => __('Grants')
        ,'public' => true
        ,'rewrite' => array(
          'slug' => 'grantee'
        )
        ,'supports' => array(
          'author'
          ,'revisions'
          ,'partners'
        )
        ,'hide_meta_box' => array(
          'slug'
          ,'author'
          ,'revisions'
          ,'comments'
          ,'commentstatus'
        )
      );
    return $post_types;
    }
    
    add_filter('piklist_empty_post_title', 'grants_new_title', 10, 2);
      function grants_new_title($data, $post_array)
      {
    
        // Grab the new title from the custom field. Replace my_custom_field with your own
        $new_title = $post_array['_post_meta']['grantee_name'][0];
    
        // Only filter on your custom post type. Replace my_custom_cpt with your own.
        return $post_array['post_type'] == 'grantee' ? $new_title : $post_array['post_title'];
      }
    tuckerjoenz
    Member

    Ok, that sounds more like what I need. I looked at the links and tried to get this to work. I’m new to WP and some of the docs are a little hard to figure out. Here is my code inside the functions file:

    add_filter( 'manage_edit-grantee_columns', 'set_custom_edit_grantee_columns' );
    add_action( 'manage_grantee_posts_custom_column' , 'custom_grantee_column', 10, 2 );
    
    function set_custom_edit_grantee_columns($columns) {
        $columns['grantee_name'] = __( 'Grantee Name', 'your_text_domain' );
    
        return $columns;
    }
    
    function custom_grantee_column( $column, $post_id ) {
        switch ( $column ) {
    
            case 'grantee_name' :
                $terms = get_the_term_list( $post_id , 'grantee_name' , '' , ',' , '' );
                if ( is_string( $terms ) )
                    echo $terms;
                else
                    _e( 'Unable to get grantee(s)', 'your_text_domain' );
                break;
    
        }
    }

    Now in my Grants List it has a column of Grant Name, still has title, but returns “Unable to get grantee(s)”.

    tuckerjoenz
    Member

    Ok so that didn’t help with the data already in. The still showed as numbers and the Grant Name was missing. Thank you though!

    tuckerjoenz
    Member

    I want to do this for both. I was told they don’t want me to play with the data they imported but for data already there and future posts I’d like the “grantee_name” to be the “Title” that shows in the list. Thanks @Jason for that I’ll give it a try your recommendation:

    piklist('field', array)
      'type'      => 'text',
      'field'     => 'post_title',
      'scope'     => 'post',
      'label'     => 'Title'
    ));
    tuckerjoenz
    Member

    Sure, emailing you now. Thanks!

    tuckerjoenz
    Member

    Hello, yes I do. What is causing this to appear. It wasn’t there and now seems to be there. Here is my stories.php:

    <?php
    /*
    Title: Stories of Impact
    Post Type: stories
    Order: 14
    Meta Box: false
    Collapse: false
    */
    ?>
    
    <?php
    
      piklist('field', array(
        'type' => 'file'
        ,'field' => 'arcus_media'
        ,'scope' => 'post_meta'
        ,'label' => __('Media Uploader','story-media')
        ,'description' => __('Validation rule set: Upload no more than two files.','story-media')
        ,'options' => array(
          'modal_title' => __('Add File(s)','story-media')
          ,'button' => __('Add','story-media')
        )
      ));
    
      piklist('field', array(
         'type' => 'datepicker'
         ,'field' => 'arcus_date'
         ,'label' => 'Story Date'
         ,'description' => 'Click in box'
         ,'attributes' => array(
           'class' => 'text'
         )
        ,'options' => array(
           'dateFormat' => 'M d, yy'
           ,'firstDay' => '0'
        )
      ));
    
      piklist('field', array(
        'type' => 'editor'
        ,'scope' => 'post'
        ,'field' => 'post_content'
        ,'template'=>'field'
        ,'label' => 'Add Story'
        ,'description' => 'Stories of Impact'
        ,'options' => array (
          'media_buttons' => true
          ,'teeny' => true
          ,'textarea_rows' => 5
          ,'drag_drop_upload' => true
        )
      ));
    in reply to: Some goodies for Piklist #2309
    tuckerjoenz
    Member

    Good stuff man!

    in reply to: Images on previews of Custom Post Types not showing #2260
    tuckerjoenz
    Member

    Excellent! Thanks Steve this helped!

Viewing 15 posts - 1 through 15 (of 21 total)