2

I am trying to add a custom post type by just copying and pasting the following code from WordPress website to my functions.php

function create_post_type() {
  register_post_type( 'acme_product',
    array(
      'labels' => array(
        'name' => __( 'Products' ),
        'singular_name' => __( 'Product' )
      ),
      'public' => true,
      'has_archive' => true,
    )
  );
}
add_action( 'init', 'create_post_type' );

When I run this code and try to go to WordPress dashboard, I get the following error:

Parse error: syntax error, unexpected 'function' (T_FUNCTION) in C:\xampp\htdocs\learningwordpress\wp-content\themes\learningWordPress\functions.php on line 200

I tried to look for answers and in many cases this error happens when your PHP version is older than 5.3 but I am using PHP version: 7.1.18, so it cannot be because of that.

Kirk Beard
  • 9,569
  • 12
  • 43
  • 47
Gustavs
  • 73
  • 1
  • 2
  • 8

1 Answers1

2

After looking at the full file you shared on https://codepen.io/crazyGG/pen/pOXEGX

add_action('wp_head', 'learningWordPress_customize_css')

It appears as if you are missing a semi colon after line 155.

Melvin M.
  • 3,280
  • 3
  • 15
  • 23