Hello,
I need to have multi uploading image functionality in my custom widget.
<?php
function form($instance) {
/*For single image upload*/
//$image_uri = isset( $instance[‘image_uri’] ) ? esc_url_raw( $instance[‘image_uri’] ) : ”;
/*For multiple image upload*/
$image_uri = pco_image_field( $this, $instance, array( ‘field’ => ‘image_uri’ );
if ( $image_uri != ” ) :
echo ‘<p></p>’;
endif;
?>
<p><label for=”<?php echo $this->get_field_id(‘image_uri’); ?>”><?php _e(‘Upload image.’, ‘abc’); ?></label></p>
<p><input type=”button” class=”button button-primary custom_media_button” id=”custom_media_button” name=”<?php echo $this->get_field_name(‘image_uri’); ?>” value=”Upload Image” style=”margin-top:5px;” /></p>
<p><input class=”widefat custom_media_url” id=”<?php echo $this->get_field_id( ‘image_uri’ ); ?>” name=”<?php echo $this->get_field_name( ‘image_uri’ ); ?>” type=”text” value=”<?php echo $image_uri; ?>” size=”3″ /></p>
<p>
<label for=”<?php echo $this->get_field_id(‘content’); ?>”><?php _e(‘CSR Content’, ‘abc’); ?></label>
<textarea class=”widefat” id=”<?php echo $this->get_field_id(‘content’); ?>” name=”<?php echo $this->get_field_name(‘content’); ?>”><?php echo $content; ?></textarea>
</p>
<?php
}
How should i use it in
function update($new_instance, $old_instance) & function widget($args, $instance) function. Kindly help me out for the same.
]]>I’m tying to make my image field work with the “public function update ($new_instance, $old_instance)” that I use with other fields of my widget. The second I delete this function, the image id is showed in the $instance variable. Otherwise, It seems like nothing is updated in the $instance variable.
thanks
]]>Hello,
new wp dev here, this plugin works great… how to change preview size?
I found pcoiwf_preview_size but I don’t know how to use it.
Please help me!
Sq.
]]>Hey,
i’m tried to use your plugin – looks very nice, but instead of print my picture it only shows me the id of the Picture, is there any solution?
My Widget code:
Form function:
public function form( $instance ) {
pco_image_field( $this, $instance, array( 'field' => 'myID' ) );
}
The Frontend-Function:
public function widget( $args, $instance) {
echo $instance['myID'];
}
]]>
Install the widget and does not leave any option to add an image that could be happening.
]]>Fatal error: Call to undefined function pco_image_widget() in /home/dev/public_html/my_site/wp-content/themes/functions.php on line 74
The plugin doesn’t NOT contain the pco_image_widget() function !
]]>