WordPress.org

Ready to get started?Download WordPress

Forums

insert into a single page (14 posts)

  1. brian goldstein
    Member
    Posted 2 months ago #

    Hi!

    I am certain this is a very basic question someone can answer quickly and well. I'm pretty much a php noob and I did not write, but need to insert , the following 2 lines into a single page on a WP site for a client.

    <script src="//survey.aspx"></script>
    and
    <script src="//survey.js"></script>

    JS is enqueued properly.

    thoughts?

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 months ago #

    I don't think you can usually run an .aspx script on a PHP enabled server. And if your .js is correctly enqueued, why would you be adding <script src="//survey.js"></script> to any file?

  3. brian goldstein
    Member
    Posted 2 months ago #

    I guess it isn't! I'm coming in very late to this project. Everything looks to be in order on header.php and functions.php.

    I just really do not know what to do. I'm also not confident I can properly format that in php.

  4. esmi
    Theme Diva & Forum Moderator
    Posted 2 months ago #

    Have you reviewed wp_enqueue_script()?

  5. brian goldstein
    Member
    Posted 2 months ago #

    yes.

    So - here's what's happened.

    Went from wp_enqueue_script to my page template.php file. Edited it to include the enqueue call. got "Fatal Error: call to undefined function enqueuescript()"

    So added
    add_action('wp_enqueue_script', 'my_script') to functions.php - and forgot to back-up. now getting Parse Error: syntax error, unexpected T_string in that file on a line that when I check in dreamweaver on my mac, isn't there.

    how do I fix?

  6. brian goldstein
    Member
    Posted 2 months ago #

    so checked the code in a different editor.

    the error message says error is on line 922, which is just:

    <?php break;

    now even more confused.

  7. esmi
    Theme Diva & Forum Moderator
    Posted 2 months ago #

    Try switching to the default theme by renaming your current theme's folder inside wp-content/themes and adding "-old" to the end of the folder name using FTP or whatever file management application your host provides. That should get your site back up. Then you need to remove those changes from your theme's function.php file.

  8. brian goldstein
    Member
    Posted 2 months ago #

    and if I don't have ftp access right this instant?

  9. esmi
    Theme Diva & Forum Moderator
    Posted 2 months ago #

    Then there's absolutely nothing you can do until you get access. :-(

  10. brian goldstein
    Member
    Posted 2 months ago #

    Thanks ESMI. ugh.

  11. esmi
    Theme Diva & Forum Moderator
    Posted 2 months ago #

    I know it's a bit late now but if you do plan on doing any more theme/code work, you might want to look at installing WordPress locally.

    Failing that, I'd suggest never editing a theme online if you can possibly avoid it. Instead, download the relevant template file using FTP, make a backup copy & then open in in a plain text editor. Make your changes, save the file & upload it. Then, if things do go pear-shaped, you can quickly upload your backup copy.

  12. brian goldstein
    Member
    Posted 2 months ago #

    Thanks again.

    I hate being brought in to things late like this for this very reason.

    Those are great points that I've used in other sites - just thought I'd be adding a line of code and was careless.

  13. brian goldstein
    Member
    Posted 2 months ago #

    Got into file manager, renamed the broken theme and now have the site up as twentythirteen.

    now - how do I correct the error in the broken theme?

  14. brian goldstein
    Member
    Posted 2 months ago #

    nm... had a copy of theme w/ no errors. resolved.

Reply

You must log in to post.

About this Topic

Tags