• Resolved cybermatrixmedia

    (@cybermatrixmedia)


    All i did was paste a line of code that allowed more related products on a product page. When i tried to update I got this error. I removed the code and still the same error. I even removed all the coding from the function.php page and still get this error. I’m confused, especially since I only know enough php to modify, not to hard code or troubleshoot.

    Parse error: syntax error, unexpected ‘<‘ in /home/content/64/10994364/html/website/wp-content/themes/twentyfourteen-child/functions.php on line 67

    This is my entire function.php page:

    <?php
    
    // Remove old copyright text
    add_action( 'init' , 'mh_remove_copy' , 15 );
    function mh_remove_copy() {
            remove_action( 'attitude_footer', 'attitude_footer_info', 30 );
    }
    
    // Add my own copyright text
    add_action( 'attitude_footer' , 'mh_footer_info' , 30 );
    function mh_footer_info() {
       $output = '<div class="copyright">'.'Copyright © [the-year] [site-link] All Rights Reserved'.'</div><!-- .copyright -->';
       echo do_shortcode( $output );
    }
    add_filter( 'woocommerce_product_tabs', 'sb_woo_remove_reviews_tab', 98);
    function sb_woo_remove_reviews_tab($tabs) {
    
     unset($tabs['reviews']);
    
     return $tabs;
    }
    /**
     * WooCommerce Extra Feature
     * --------------------------
     *
     * Register a shortcode that creates a product categories dropdown list
     *
     * Use: [product_categories_dropdown orderby="title" count="0" hierarchical="0"]
     *
     */
    add_shortcode( 'product_categories_dropdown', 'woo_product_categories_dropdown' );
    
    function woo_product_categories_dropdown( $atts ) {
    
      extract(shortcode_atts(array(
        'count'         => '0',
        'hierarchical'  => '0',
        'orderby' 	    => ''
        ), $atts));
    
    	ob_start();
    
    	$c = $count;
    	$h = $hierarchical;
    	$o = ( isset( $orderby ) && $orderby != '' ) ? $orderby : 'order';
    
    	// Stuck with this until a fix for http://core.trac.wordpress.org/ticket/13258
    	woocommerce_product_dropdown_categories( $c, $h, 0, $o );
    
    	?>
    	<script type='text/javascript'>
    	/* <![CDATA[ */
    		var product_cat_dropdown = document.getElementById("dropdown_product_cat");
    		function onProductCatChange() {
    			if ( product_cat_dropdown.options[product_cat_dropdown.selectedIndex].value !=='' ) {
    				location.href = "<?php echo home_url(); ?>/?product_cat="+product_cat_dropdown.options[product_cat_dropdown.selectedIndex].value;
    			}
    		}
    		product_cat_dropdown.onchange = onProductCatChange;
    	/* ]]> */
    	</script>
    	<?php
    
    	return ob_get_clean();
    }

    Any help is appreciated.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The code posted above is only 65 lines long.

    Thread Starter cybermatrixmedia

    (@cybermatrixmedia)

    That’s my point. I deleted the entire coding from the page and still get that error. that’s why I’m so confused.

    Should I delete the child theme and start fresh? Would that solve the problem?

    Are you using a caching plugin?

    Thread Starter cybermatrixmedia

    (@cybermatrixmedia)

    super cache was used at install to disable caching then I disabled that plugin also

    Thread Starter cybermatrixmedia

    (@cybermatrixmedia)

    First I backed up my child theme. Then I deleted the child theme which allowed me to access my website again. Then I activated the parent theme. After that I imported the child them back into the theme folder and deleted the function.php from the child theme directory. Then I recreated a blank function.php. That allowed me to reactivate my child them and everything works again.

    All I have to do now is paste each portion of my function.php back in. Saving and refreshing to make sure the site works after each part is pasted back in.

    Thanks for the all the responses.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘function.php parse error’ is closed to new replies.