Wordpress Theme - Parse Error: Unexpected end of file

Asked

Viewed 142 times

-3

I updated my Wordpress site from PHP 5.2 to PHP 7.0 and when I’m trying to restore this site to a new host, I’m getting an error in my custom theme:

Parse error: syntax error, Unexpected end of file in /opt/Bitnami/apps/wordpress/htdocs/wp -content/themes/insight/functions.php on line 125

Follows the code:

<?php



function register_my_menus() {
  register_nav_menus(
    array( 'top-menu' => __( 'Menu Topo' ), 'bottom-menu' => __( 'Menu Inferior' ))
  );
}
add_action( 'init', 'register_my_menus' );


if ( function_exists( 'add_theme_support' ) ) { 
  add_theme_support( 'post-thumbnails' ); 

}


if(function_exists('add_theme_support')) {

   add_image_size( 'sobre', 550, 210, true );

   add_image_size( 'clientes', 180, 150, true );

}


function wpprogrammer_post_name_in_body_class( $classes ){
    if( is_singular() )
    {
        global $post;
        array_push( $classes, "{$post->post_type}-{$post->post_name}" );
    }
    return $classes;

}
function add_category_to_single($classes) {
    if (is_single() ) {
        global $post;
        foreach((get_the_category($post->ID)) as $category) {

            $classes[] = "category-".$category->category_nicename;
        }
    }

    return $classes;

}
add_filter('body_class','add_category_to_single');
add_filter( 'body_class', 'wpprogrammer_post_name_in_body_class' );


add_custom_background();


register_sidebar();


function nerdy_get_images($size = 'thumbnail', $limit = '0', $offset = '0', $gallery_id = 'footer') {
    global $post;
    $images = get_children( array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') );
    if ($images) {
        $num_of_images = count($images);
        if ($offset > 0) : $start = $offset--; else : $start = 0; endif;
        if ($limit > 0) : $stop = $limit+$start; else : $stop = $num_of_images; endif;
        $i = 0;
        foreach ($images as $image) {
            if ($start <= $i and $i < $stop) {
            $img_title = $image->post_title;   
            $img_description = $image->post_content; 
            $img_caption = $image->post_excerpt; 
            $img_url = wp_get_attachment_url($image->ID); 
            $preview_array = image_downsize( $image->ID, $size );
            $img_preview = $preview_array[0]; 
            ?>
            <li>
                <img src="<?php echo $img_preview; ?>" alt="<?php echo $img_caption; ?>" title="<?php echo $img_title; ?>">
            </li>
            <?
            endif;
            }
            $i++;
        }
    }
}

add_action('init', 'creat_post_cliente'); 

function creat_post_cliente()
{
    register_taxonomy_for_object_type('category', 'cliente'); 
    register_taxonomy_for_object_type('post_tag', 'cliente');
    register_post_type('cliente', 
        array(
        'labels' => array(
            'name' => __('Cliente', 'cliente'), 
            'singular_name' => __('cliente Custom Post', 'cliente'),
            'add_new' => __('Adicionar nova cliente', 'cliente'),
            'add_new_item' => __('Adicionar nova cliente', 'cliente'),
            'edit' => __('Edit', 'cliente'),
            'edit_item' => __('Edit cliente', 'cliente'),
            'new_item' => __('New cliente', 'cliente'),
            'view' => __('View cliente', 'cliente'),
            'view_item' => __('View cliente', 'cliente'),
            'search_items' => __('Search cliente', 'cliente'),
            'not_found' => __('No cliente found', 'cliente'),
            'not_found_in_trash' => __('No cliente found in Trash', 'cliente')
        ),
        'public' => true,
        'hierarchical' => true, 
        'has_archive' => true,
        'supports' => array(
            'title',
            'editor',

            'thumbnail'
        ), 
        'can_export' => true, 
        'taxonomies' => array(
            'category'
        )

    );

} ?php>

1 answer

1

That is typo, there is no Closing tag like this in PHP:

?php>

In PHP you should use:

?>

Or as it is a script without HTML, only for the functions, you can omit the ?>, or close.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.