0
votes

Here is my code for a wordpress plugin that I am developing.

        <?php
    /*
        Plugin Name: My Javascript Plugin
    */

    // add the admin options page
    add_action('admin_menu', 'plugin_admin_add_page');
    function plugin_admin_add_page() {
    add_menu_page('Jesus Is Lord', 'Lord Jesus', 'manage_options', 'plugin', 
                  'plugin_options_page');


    }
    ?>

    <?php 
    // display the admin options page
    function plugin_options_page() {
    ?>
    <div>
    <h2>Jesus Is Lord</h2>
    In the beginning God created the Heavens and the Earth.

    <form action="options.php" method="post">
    <?php settings_fields('plugin_options'); ?>
    <?php do_settings_sections('plugin'); ?>        
    <input name="Submit" type="submit" value="<?php esc_attr_e('Jesus Saves'); ?>" />
    </form>
    </div>
    <?php } ?>

    <?php 
    add_action('admin_init', 'plugin_admin_init');
    function plugin_admin_init(){
    register_setting( 'plugin_options', 'plugin_options', 'plugin_options_validate' );
    add_settings_section('plugin_main', 'Main Settings', 'plugin_section_text', 
                        'plugin');
    add_settings_field('plugin_text_string', 'Plugin Text Input', 
                       'plugin_setting_string', 'plugin', 'plugin_main');
    ?>

I am new to plugin development and I can't figure out why I am getting this error:

Parse error: syntax error, unexpected $end in C:\xampp\htdocs\...\wp-content\plugins\myjavascriptplugin\myjavascriptplugin.php on line 42
2

2 Answers

3
votes

You never close the function plugin_admin_init.

You're missing a closing brace } before the final ?> in your code.

0
votes

YOu are missing a } in your code