Viewing 2 reply threads
  • Author
    Posts
    • #5052
      hyfyn
      Member

      I am using meta-boxes to upload files then looping through them and displaying them on the front-end. When I remove a file from the meta-box it is still in the loop and results in a Notice: Trying to get property of non-object.

      here is my code
      //the piklist meta-box

      piklist('field', array(
        'type' => 'file',
        'field' => 'services_media',
        'scope' => 'post_meta',
        'label' => __('Add Services Pictures','piklist'),
        'description' => __('Upload Pictures for Services.','piklist'),
        'help' => 'Upload image(s) to feature in the services section.',
        'options' => array(
          'modal_title' => __('Add Logos','piklist'),
          'button' => __('Add','piklist')
        ),
        'add_more' => false
      ));

      //the loop

      $image_ids = get_post_meta($post->ID, 'services_media');
      // loop through images and display them
      foreach ($image_ids as $image) {
      // get values of image
        $img = get_post($image);
        $title = $img->post_title;
        $caption = $img->post_excerpt;
        $alttext = trim(strip_tags( get_post_meta($image, '_wp_attachment_image_alt', true) ));
        $description = $img->post_content;
      // print out image
        echo '<div class="small-12 medium-4 column '.$caption.'"><img src="' . wp_get_attachment_url($image) . '" alt="'. $alttext . '" /><p>'.$caption.'</p></div>';
      					}
    • #5068
      Steve
      Keymaster

      @hyfyn– Welcome to the Piklist community!

      This is definitely a bug with our file uploader and will be addressed in the next version of Piklist.

    • #5079
      hyfyn
      Member

      Thanks Steve, I love the framework and this is the fist issue I have had. I look forward to the new version

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