• Resolved baggadap

    (@baggadap)


    Hi all

    I have made a custom admin menu with a simple code like this:
    https://github.com/pods-framework/pods/wiki/Custom-Admin-Menu-UI-Example:-Slideshow

    It works great, however, I have one issue: The “Featured Image” (Post Thumbnail) it not displayed in the Add/Edit screens.
    In fact, the Post Title is not shown either, but that can be fixed by adding ‘name’ to the $fields -> ‘manage’-array.

    Is there a way to display “Featured Image” and/or enable the “Screen Options” menu, as that possibly could trigger displaying both?

    Thanks in advance.

    Mathias

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jim True

    (@jimtrue)

    well, if you’re using pods_ui, that has no access to ‘Screen Options’. You’d have to share your code if you wanted us to help you identify where you can add the other fields.

    Featured Image is post_thumbnail the title is post_title; perhaps, you can add those to the $fields->’manage’ array? Can’t help you much more than that without your code.

    Thread Starter baggadap

    (@baggadap)

    Jim, Thank you so much for the quick answer!
    I have the Featured Image in the ‘manage’ array already, I need it when I’m going to the “add” or “edit” screens. Here is my code:

    $object = pods('koncert');
    $fields = array();
    
    //iterate through registered fields
    foreach($object->fields as $field => $data) {
    	$fields[$field] = array('label' => $data['label']);
    }
    
    $edit_fields = $fields;
      
    
    //fields visible on manage screens
    $manage_fields = array(
        	'name', 
        	'post_thumbnail.100x100' => 'Foto',
        	'koncerter_start_date', 
       
    );
    
    $object->ui = array(
        	'wp-css' => 1,
            'item'   => 'book',
            'items'  => 'books',
            'fields' => array(
                'add'       => $fields,
                'edit'      => $edit_fields,
                'duplicate' => $fields,
                'manage'    => $manage_fields,
            ),
           'actions_bulk' => array(
                //adds built in delete function
                'delete' => array(
                'label' => 'Delete',
                ),
            ),
        );
    pods_ui($object);
    Plugin Author Jim True

    (@jimtrue)

    I confirmed with our developers the add/edit is using our standard form api from within Pods and Post Thumbnail/Featured Image doesn’t work in the built-in forms.

    There is an outstanding Feature request to correct this one:
    https://github.com/pods-framework/pods/issues/1005

    Please feel free to add your ‘vote’ behind it 😉

    Thread Starter baggadap

    (@baggadap)

    Dear Jim

    Thank you so much!
    In the meantime, a workaround would be to use the “action_links”-array and link to the default add/edit post.php page.
    But how do I get the post ID within the array to build the “edit” link?

    'action_links' => array( 
     //Override the array that builds the edit link, you may supply a string with the name of a helper to get the array from - or give the array itself
     'add'      => 'post-new.php?post_type=koncert',
     'edit'      => 'post.php?post='.$function_to_get_id().'&action=edit',
     ),
    
    Plugin Author Jim True

    (@jimtrue)

    I think that would depend on if you’re in the loop at the moment. Since you’re kind of moving into custom code, it would probably be better if you jump on our Slack Chat and ask that question the #dev-chat channel.

    get_the_id() would work if you’re in the loop, but I’m not sure which object you’re actually looping through, if you are looping through a Pods Object or a post object. pods_ui is not well documented as it’s a fairly advanced programming tool so most of the docs for it are inline. That’s why it’s better to ask that one in our Chat.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Pods UI – Featured Image’ is closed to new replies.