how to avoid errors in vscode when making a wordpress theme? - wordpress-theming

How to avoid errors due to not having the specific functions of wordpress inside the projet when making a Wordpress Theme on Visual Studio Code ?
Is there a plugin to download ?

Wordpress stubs are included in In VSCode.
You just need to activate it.
If you follow these steps your errors will disapear.
Hit the gear icon.(bottom left)
Select settings.
Search for stubs.
Scroll all the way down an click
on 'Add item'.
Hit the dropdown menu.
Press w(on your keyboard) and
scroll to worpress and select it.
Hit ok.
Now all the error should disapear.
If not, try to restart VSCode.

Open VS Code in the root of the WordPress installation.
You get this error because you are referring to functions that are not in your open files in your editor.

You can try using WordPress Stubs https://github.com/php-stubs/wordpress-stubs. The easy way is download this file https://raw.githubusercontent.com/php-stubs/wordpress-stubs/master/wordpress-stubs.php (Wordpress v5.8.1) and paste in your theme.

Related

Cannot connect to localhost on Chrome when using VSCode

Just written a HTML document using VSCode. When i run via Chrome it opens a window on localhost:8080, but says that the site cannot be reached. 'Refused to connect'
Can anyone tell me where I'm going wrong?
Usually use Notepad++ which i realise is so much more straightforward than VSCode.
Thanks.
You can just click on the file and it will run automatically.
You don't need localhost to view an HTML page, just find the HTML on your desktop or documents or where ever you created it, right click on the file and open it with a browser of your choice
You can then edit the file in VSCode or Notepad++ or any text editor of your liking, then go back to the browser and reload the page to see the changes to your file
You enter your project. And you can run as writing 'ng serve'. VSCode will show your localhost and you should press it to run the project.
[Javascript],[VisualStudioCode],[AngularJS]

How to run simple HTML & CSS project in WebStorm? (404 localhost)

I'm trying to run simple UX project.
I have HTML and CSS files, but I don't know, how to run it with WebStorm. I've tried to click on Chrome icon, but 404
Please, help me
right click on index.html page in webstorm and choose run from menu or press ctrl+shift+f10
also you can run page directly from browser address bar:
file:///D:/Frontend/01-about-cats/index.html

PhpStorm: Save as Live Template does nothing

Trying to create a Live Template in PhpStorm by highlighting a block of text, going to Tools > Save as Live Template.
When I do this, nothing happens. The Live Template dialog does not open and there is no other indication of an error. I can manually open the Live Template menu and add one there.
Is there a setting or configuration that is needed for this to be enabled?
PhpStorm 2017.1.4 on Windows 10
You can turn a highlighted block into a live template, but you need to make sure that there is no leading whitespace in your selected text, or it won't do anything, as explained in the original question.
This is likely a bug, see the issue in the comments to track resolution.

Why does visual studio not run current html file

I am currently designing a website using Visual Studio 2015 Community and, for whatever reason, when I launch the website it will not launch the most current html file. Even though I have saved the newest file it will launch a previously created version of the website. Does anyone know why this might be happening?
Make sure the current html page is inside the project(from solution explorer).
If you make a new file from 'File' menu it will not be saved inside your project.
To create file inside project write click Proj name(in solution explorer) and click add -> file
In solution explorer right click on your project then select properties
after that from left panel select web
from there you can see three radio buttons inside start actions select current page
(or the option that suits you)

Suspect wordpress is not setting cookies

I'm trying to make a simple login form.
The wordpress function
is_user_logged_in() always returns false.
I don't want to use any pre-existing themes for wordpress, and I want to simply add wordpress functionality to an existing page.
I checked the cookies on my page with the form, and none are being set.
The wordpress install is located at:
http://localhost/newgameplus/wordpress/
The testings script is located at:
http://localhost/newgameplus/TEST/scripts/php/testWP.php
EDIT:
Solved this issue by going to wp admin panel, and changing the options.
Settings>General Settings
Adjusted site Address to reflect the actual website location.
Your script is running in a different web space to the WordPress install. To access the Wordpress functionality you'll need to be working on the site within the wordpress web space - ie the
http://localhost/newgameplus/wordpress/
directory