Coder Social home page Coder Social logo

Comments (10)

carolinan avatar carolinan commented on May 5, 2024 1

Try using a different theme name, since wp_ is already used as a prefix.

from wprig.

ygagnon avatar ygagnon commented on May 5, 2024 1

Re-installing worked. I'm now up and running without errors. Thanks for your help!
-- Yvan

from wprig.

hellofromtonya avatar hellofromtonya commented on May 5, 2024

Fatal error: Cannot redeclare wp_scripts() (previously declared in C:\wamp64\www\wp\wp-includes\functions.wp-scripts.php:21) in C:\wamp64\www\wp\wp-content\themes\wp\functions.php on line 292

That error is telling you that you are attempting to redeclare the function wp_scripts. That function exists in WordPress Core.

You have your theme named as wp in the themes folder. I'm guessing that you are also using the prefix of wp_. As @carolinan pointed out, you need to change your prefix to be something other than wp_.

Notice that with WP Rig theme, it's prefixed as wprig_. For you, give it a name that you want, some unique name for your theme.

from wprig.

ygagnon avatar ygagnon commented on May 5, 2024

I tried changing my theme folder name from "wp" to "yvan" .. then updated the theme name in my "themeConfig.js" file .. and then re-ran "npm install" and "npm run build" .. but I still get the same fatal error when I attempt to activate the theme:

Fatal error: Cannot redeclare wp_scripts() (previously declared in C:\wamp64\www\wp\wp-includes\functions.wp-scripts.php:21) in C:\wamp64\www\wp\wp-content\themes\yvan\functions.php on line 292

Is it really necessary that I re-install WordPress using a different table prefix?

  • Yvan

from wprig.

hellofromtonya avatar hellofromtonya commented on May 5, 2024

A Little Background on the Error:

Look at the error. It's telling you that you have a function called wp_scripts() on line 292 in your functions.php file. That function exists in WordPress Core. You need to rename the function to something else.

**Best practice is not to prefix using wp_. **

How to fix?

You've already run npm run build previously when your theme slug was wp. During that build process, it renamed everything to start with that prefix.

How do you fix that? Well, after changing the themeConfig.js file, you'll need to re-run npm run build. But hold on. By doing so, it does not rename all of the functions in the PHP files. Hmm.

@ygagnon To get going, you'll need to delete the generated theme PHP files. Then re-run npm run build.

from wprig.

hellofromtonya avatar hellofromtonya commented on May 5, 2024

I'll create a new issue to deal with re-running npm run build and rebuilding the PHP files.

from wprig.

ygagnon avatar ygagnon commented on May 5, 2024

Deleting all of the generated PHP files and re-running "spm run build" allowed me to activate the wprig theme without errors .. but now the front end of the site is throwing errors .. almost as though there are some other non-PHP files that I also need to delete:

Fatal error: Uncaught Error: Call to undefined function yvan_is_amp() in C:\wamp64\www\wp\wp-content\themes\yvan\header.php:20 Stack trace: #0 C:\wamp64\www\wp\wp-includes\template.php(688): require_once() #1 C:\wamp64\www\wp\wp-includes\template.php(647): load_template('C:\wamp64\www\w...', true) #2 C:\wamp64\www\wp\wp-includes\general-template.php(41): locate_template(Array, true) #3 C:\wamp64\www\wp\wp-content\themes\yvan\index.php(15): get_header() #4 C:\wamp64\www\wp\wp-includes\template-loader.php(74): include('C:\wamp64\www\w...') #5 C:\wamp64\www\wp\wp-blog-header.php(19): require_once('C:\wamp64\www\w...') #6 C:\wamp64\www\wp\index.php(17): require('C:\wamp64\www\w...') #7 {main} thrown in C:\wamp64\www\wp\wp-content\themes\yvan\header.php on line 20

from wprig.

ygagnon avatar ygagnon commented on May 5, 2024

I'm going to try deleting all files and re-installing the github package. I'll report back afterwards.

  • Yvan

from wprig.

hellofromtonya avatar hellofromtonya commented on May 5, 2024

@ygagnon Good idea. Delete the folder. Clone it again. Start over. Let's see if the problem goes away.

from wprig.

hellofromtonya avatar hellofromtonya commented on May 5, 2024

Yippee!! Thanks for your patience, @ygagnon. You can go ahead and close this issue since it's resolved for you.

BTW I did open a new issue for discussing the ability to regenerate/rebuild PHP files after running the build.

from wprig.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.