Notice: This thread is over two years old; the information may be outdated. Please consider creating a new thread if you require free support. If you have an active SiteOrigin Premium license, you can email our premium support desk at [email protected].
HI i am trying to duplicate and enhance the image widget of site origin i have this code but i can’t get the template to show up
<?php /* Widget Name: SquareMedia Image Widget Description: An image widget with enhance capabilities Author: Square media Inc. Author URI: http://thesquaremedia.com */ class SquareMedia_Image_Widget extends SiteOrigin_Widget { function __construct() { parent::__construct( 'squaremedia-image-widget', __('SquareMedia Image Widget', 'squaremedia-image-widget-text-domain'), array( 'description' => __('A simple image widget with massive power.', 'squaremedia-image-widget-text-domain'), 'help' => 'http://thesquaremedia.com' ), array( ), array( 'image' => array( 'type' => 'media', 'label' => __('Image file', 'siteorigin-widgets'), 'library' => 'image', 'fallback' => true, ), 'size' => array( 'type' => 'select', 'label' => __('Image size', 'siteorigin-widgets'), 'options' => array( 'full' => __('Full', 'siteorigin-widgets'), 'large' => __('Large', 'siteorigin-widgets'), 'medium' => __('Medium', 'siteorigin-widgets'), 'thumb' => __('Thumbnail', 'siteorigin-widgets'), ), ), 'title' => array( 'type' => 'text', 'label' => __('Title text', 'siteorigin-widgets'), ), 'title_hover' => array( 'type' => 'checkbox', 'default' => false, 'label' => __('Title as Hover', 'siteorigin-widgets'), 'description' => __("Use the title text for the hover of the link", 'siteorigin-widgets'), ), 'hover_bg_color' => array( 'type' => 'color', 'label' => __( 'Hover Background Color', 'siteorigin-widgets' ), 'description' => __("Choose a color for the hovers background", 'siteorigin-widgets'), 'default' => '#FFFFFF' ), 'opacity_number' => array( 'type' => 'number', 'label' => __( 'Hover Opacity', 'widget-form-fields-text-domain' ), 'description' => __("Choose the opacity of the hover must be from 0 to 1", 'siteorigin-widgets'), 'default' => '0.8' ), 'alt' => array( 'type' => 'text', 'label' => __('Alt text', 'siteorigin-widgets'), ), 'url' => array( 'type' => 'link', 'label' => __('Destination URL', 'siteorigin-widgets'), ), 'new_window' => array( 'type' => 'checkbox', 'default' => false, 'label' => __('Open in new window', 'siteorigin-widgets'), ), 'bound' => array( 'type' => 'checkbox', 'default' => true, 'label' => __('Bound', 'siteorigin-widgets'), 'description' => __("Make sure the image doesn't extend beyond its container.", 'siteorigin-widgets'), ), 'full_width' => array( 'type' => 'checkbox', 'default' => false, 'label' => __('Full Width', 'siteorigin-widgets'), 'description' => __("Resize image to fit its container.", 'siteorigin-widgets'), ), ), plugin_dir_path(__FILE__) ); } function modify_form($form){ global $_wp_additional_image_sizes; if( !empty($_wp_additional_image_sizes) ) { foreach($_wp_additional_image_sizes as $i => $s) { $form['size']['options'][$i] = $i; } } return $form; } function get_style_hash($instance) { return substr( md5( serialize( $this->get_less_variables( $instance ) ) ), 0, 12 ); } function get_template_name($instance) { return 'squaremedia-image-widget-template'; } function get_style_name($instance) { return false; } function get_less_variables($instance){ return array(); } } siteorigin_widget_register('squaremedia-image-widget', __FILE__, 'SquareMedia_Image_Widget');
i know the issue can’t be on the template file because even if i just add html it doesn’t show up.
Hi Xavier
Would it be possible for you to send me a copy of your theme/plugin with this code? If you have it on Github I can check it out there, or else a link to Dropbox file will work. If it’s still a work in progress, you can make your reply private.
I actually figure it out it seems that it was a name base issue with the classes and file names.