Error after activate

Hi

Thanks for the theme.

I have an issue after I activate the theme, I get the following error.

Parse error: syntax error, unexpected ‘[’ in /home/XXXXXXXX/public_html/XXXXXXXX/wp-content/themes/shapely/inc/widgets/widget-home-clients.php on line 18

Thanks

Hi @gcneal,

Sorry to hear of the problem you are having.

I have tested it on my test site but didn’t get any such error message.

Could you please try deleting and reinstalling fresh version of Shapely theme?

If the issue persists after reinstalling the theme then please share me the screenshot of the error message so that i can troubleshoot it.

Kind Regards,
Movin

Hi Movin

Please see attached.

Thanks in advance.

Have you tried resintalling the theme?

And also make sure that you have disabled the WordPress debugging.

.

Hi Movin

I should of mentioned I did deleted and reinstall the theme as you suggested, however the same issue appeared.

Debug was set to false, so I changed to true, however still got the same message, so changed it back to false.

I assume false is the same as disabled?

Thanks

Also experiencing the same issue. Have tried with two sites. Live preview is blank white, activation stalls with a white screen and both frontend and backend are blank. Removing the theme restores the admin for me where I can select a different theme and this restores the frontend. Nice theme, would love to try it out!

in /home/XXXXXXXX/public_html/XXXXXXXX/wp-content/themes/shapely/inc/widgets/widget-home-clients.php

Fixed: Change all occurrences of [’’] to simply ‘’

I tried to attach my file, but both PHP and TXT files have been disabled for upload.

Hi gburdett

Your suggestion worked for me.

Thank you for your help!

Hi @gburdett,

Awesome great to see you got that resolved but i still could not reproduce the issue on my test site using the [Shapely] Client Section For FrontPage widget. I also tried setting WP debug to true but no success.

May be this issue is occurring only on specific PHP version or with specific settings so could you please tell me which PHP version are you using and share the screenshot of [Shapely] Client Section For FrontPage widget settings so that i can troubleshoot it?

I tried to attach my file, but both PHP and TXT files have been disabled for upload.

You can upload them by making their zip files.

For your convenience i have modified that file and attached to this reply.

Thanks,
Movin

Hi Movin

I checked our php ver which was 5.3, and updated to the latest.

Deleted the modified theme, reinstalled the standard theme, and works fine.

Thanks for your help.

@gcneal You are most welcome here :slight_smile:

I am using PHP Version 7.0.4 so was it only the PHP version issue at your side or did you do anything else also?

Hi Movin

No, seems like it was the php version.

I changed it back to check, and the problem reappeared.

Thanks again

Ok Thanks for providing us this valuable information.

Your help here is really appreciated.

Hey @Movin,

I’m new to your Site and also want to use that theme. I also get the same Error. Can you re-upload the fixed file? I can not download it. I appreciate your work, it is awesome!

Thanks
Marcel

Hi Marcel

IF you got this error for the some reason I did, then I would recommend updating your php version. Contact your web hosting supplier, you may have access to this in your web hosting cPanel.

However I have modified the file as gburdett suggested (I’m not sure if this is the same fix as Movin suggested) but hopefully works for you.

If the theme is updated in the future and IF this fix isn’t included in the updated theme, then the same problem may occur.

Hope this helps.

So it seems like you can’t download zip files from the site, so try coping and pasting the code into the shapely/inc/widgets/widget-home-clients.php

<?php

/**
 * Homepage parralax section Widget
 * Shapely Theme
 */
class shapely_home_clients extends WP_Widget
{
    function __construct(){

        $widget_ops = array('classname' => 'shapely_home_clients','description' => esc_html__( "Shapely Client Section That Displays Logos In A Slider" ,'shapely') );
        parent::__construct('shapely_home_clients', esc_html__('[Shapely] Client Section For FrontPage','shapely'), $widget_ops);
    }

    function widget($args , $instance) {
    	extract($args);
        $title = isset($instance['title']) && !empty($instance['title']) ? $instance['title'] : __('Our Main Clients','shapely');
        $logos = isset($instance['client_logo']) ? $instance['client_logo'] : '';

        echo $before_widget;

        /**
		 * Widget Content
		 */
    ?>
    <?php if( count( $logos['img'] ) != 0 ){ ?>
      <section>
        <div class="container">
            <div class="row">
                <div class="col-sm-12 text-center">
                    <h3 class="mb64 mb-xs-40"><?php echo $title; ?></h3>
                </div>
            </div>
            <!--end of row-->
            <div class="row">
                <div class="logo-carousel">
                    <ul class="slides"><?php
                    for( $i=0; $i<count($logos['img']); $i++ ) {
                      if( $logos['img'] != '' && $logos['link'] != '' ){ ?>
                        <li>
                            <a href="<?php echo $logos['link'][$i]; ?>">
                                <img alt="<?php _e('Logos', 'shapely'); ?>" src="<?php echo $logos['img'][$i]; ?>" />
                            </a>
                        </li><?php
                      }
                    }?>
                    </ul>
                </div>
                <!--end of logo slider-->
            </div>
            <!--end of row-->
        </div>
        <!--end of container-->
    </section>
    <?php } ?>

		<?php

		echo $after_widget;
    }

    function form($instance) {
        if(!isset($instance['title']) ) $instance['title']='';
        if(!isset($instance['client_logo']['img'])) $instance['client_logo']['img']='';
        if(!isset($instance['client_logo']['link'])) $instance['client_logo']['link']='';
    ?>

      <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title ','shapely') ?></label>

      <input type="text" value="<?php echo esc_attr($instance['title']); ?>"
                          name="<?php echo $this->get_field_name('title'); ?>"
                          id="<?php $this->get_field_id('title'); ?>"
                          class="widefat" />
      </p>

      <ul class="client-sortable clone-wrapper"><?php
          $image_src = $instance['client_logo']['img'];
          $logo_link = $instance['client_logo']['link'];
          $slider_count = ( isset($image_src) && count( $image_src ) > 0 ) ? count( $image_src ) : 3 ;

          for ( $i = 0; $i < $slider_count; $i++ ): ?>
              <li class="toclone">
                <br>
                  <label class="logo_heading"><b><?php _e( 'Logo #', 'shapely' ); ?><span class="count"><?php echo absint( $i )+1; ?></span></b></label>
                  <input name="<?php echo $this->get_field_name('client_logo').'[img]['.$i.']';?>" id="<?php echo $this->get_field_id('image_src').'-'.$i; ?>" class="widefat image_src" type="hidden" size="36"  value="<?php echo (isset( $image_src[$i] )) ? esc_url( $image_src[$i] ) : ''; ?>" /><br>
                  <button id="<?php echo $this->get_field_id('image_src_button').'-'.$i; ?>" class="button button-primary custom_media_button" data-fieldid="<?php echo $this->get_field_id('image_src').'-'.$i; ?>"><?php _e( 'Upload Logo','shapely' ); ?></button>
                  <img class="image_demo" id="img_demo_<?php echo $this->get_field_id( 'image_src' ).'-'.$i; ?>" width="50px" height="50px" style="border:0; margin-left: 20px; vertical-align: top;" src="<?php echo ( isset($image_src[$i]) ) ? esc_url( $image_src[$i] ) : ''; ?>" />
                  <br/><br/>
                  <label><?php _e( 'Link:', 'shapely' ); ?></label>
                  <input name="<?php echo $this->get_field_name('client_logo').'[link]['.$i."]"; ?>" id="link<?php echo '-'.$i; ?>" class="widefat client-link" type="text" size="36"  value="<?php echo (isset( $logo_link[$i] )) ? esc_url( $logo_link[$i] ) : ''; ?>" /><br><br>

                  <a href="#" class="clone button-primary"><?php _e('Add', 'shapely'); ?></a>
                  <a href="#" class="delete button"><?php _e('Delete', 'shapely'); ?></a>
              </li>
          <?php endfor; ?>
      </ul><?php

    }

    /**
	 * Sanitize widget form values as they are saved.
	 *
	 * @see WP_Widget::update()
	 *
	 * @param array $new_instance Values just sent to be saved.
	 * @param array $old_instance Previously saved values from database.
	 *
	 * @return array Updated safe values to be saved.
	 */
	public function update( $new_instance, $old_instance ) {
		$instance = array();
		$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? esc_html( $new_instance['title'] ) : '';

		if( isset( $new_instance['client_logo']['img'] ) && count( $new_instance['client_logo']['img'] ) != 0 ){
          for( $i=0; $i<count( $new_instance['client_logo']['img'] ); $i++ ){
            $instance['client_logo']['img'][$i] = ( ! empty( $new_instance['client_logo']['img'][$i] ) ) ? esc_url( $new_instance['client_logo']['img'][$i] ) : '';
          }
        }
		if( isset( $new_instance['client_logo']['link'] ) && count( $new_instance['client_logo']['link'] ) != 0 ){
          for( $i=0; $i<count( $new_instance['client_logo']['link'] ); $i++ ){
            $instance['client_logo']['link'][$i] = ( ! empty( $new_instance['client_logo']['link'][$i] ) ) ? esc_url( $new_instance['client_logo']['link'][$i] ) : '';
          }
        }

		return $instance;
	}

}

?>

Hi @gcneal,

thanks for your reply, i will try to update php, but first i want to test the modified file. However I still get an error message on the download page “Sucuri WebSite Firewall - CloudProxy - Access Denied” Is it possible that you send me the file via E-Mail? That would be awesome and a great help.

Try downloading from

https://drive.google.com/file/d/0Bw-QmtXy1a1QMHppWjR2aVlnT2c/view?usp=sharing

Hope this helps.

@marcelpetzold Did you get the modified theme file that @gcneal shared which i can access successfully?

@gcneal Thanks for sharing it on Google drive.