I'm currently studying WordPress and want to create a custom Post Type and have copied code from a tutorial that I am following. The code in the tutorial works but when I copy/paste it into custom page template, I get the following error:
"Parse error: syntax error, unexpected T_FUNCTION in /home/databasename/public_html/wptheme/demo/wp-content/themes/name/albums.php on line 3"
I have Googled the issue for hours and there are multiple options but the issue is that I am a beginner and don't know exactly what to change. I know that the problem is on line 3 but that's it. Shown below is my code that is located in my custom page template. Any help would be greatly appreciated!
<?php
add_action('init', function() { /*this is line 3*/
register_post_type( 'album', array(
'public' => true,
'label' => 'Album',
'labels' => array('add_new_item' => 'Add New Album')
'supports' => array('title', 'editor'),
'taxonomies' => array('post_tag')
));
});
function() {}- you'll have to usecreate_function()instead or update