How to access and edit HTML Wordpress code? - php

I'm working on a project for my studies, building a website with WordPress. The code needs to pass the W3C HTML & CSS check and here arrives my problem. I get tons of errors and warnings, and I don't know how I can edit the code and fix them.
#1
I have tried the Appearance -> Editor thing, but I only have access to style.css, functions.php and wpml-config.xml. Plus, I don't have the rest of the CSS code, only what I wrote. (I'm using a child theme)
#2
I tried with the Chrome console to locate the mistakes by copy/pasting the code, but the Chrome console says it is on a different line from what W3C tells me. I sometimes don't even find it.
#3
So I tried to download the site files with FTP, but there is nothing written in index.php and other documents unlike what is shown on the Chrome console.
#4
My question is pretty simple, how can I access the PHP/HTML/CSS code of my website, and modify it?

This is not where you need to be, you should edit local files.
When you inspect a page with Dev Tools, you are seeing the live DOM. Which is a representation of the HTML you sent the browser along with any modification that JavaScript has made to the DOM. The W3C checker won't see content added/changed by JavaScript. You will need to validate that separately.
Your site is built with a WordPress Theme. Theme files are located at /wp-content/themes/[theme name]. The files that are in the theme folder that your site is using might look something like the Twenty Nineteen Theme.
You've already got the files (via FTP), you just need to look in the right place (see #3).

Related

How can I modify the Divi layout via php files?

I'm using Divi Wordpress and I wanted to add some extra markup. I added the extra markup in header.php but It's not appearing in any other page other than the homepage.
I went ahead and modified the other files (index.php, single.php, page.php) but nothing is happening.
Funny thing is that I searched the files for the current markup that is generated. I found a couple of files and modified them but nothing. I even deleted those files but nothing is happening!
How the hell is Wordpress generating that markup if it has no files that contain such a markup?
The homepage immediately knows that something is wrong (no files) but the other pages are not.
If I delete the whole divi folder, the css is gone but the markup is still generated by some divi files.
What black magic is this :)?
And yes, I forced refresh, tried another browser and restarted XAMPP.
I found the answer myself. The wordpress installation was cloned from a previous one. It seems that the files were used from that installation, so I could edit the php files untill tomorrow. Strange!

Trying to pinpoint code being added to wordpress site

I've just started doing some website work for a local business, and I noticed today that there's a very unwanted link at the bottom of their site, which is a wordpress site.
The site makes use of a woo theme called 'whiteLight', as well as woocommerce. I've tried disabling and reenabling all plugins that aren't well known and integral to the site's functioning, and I've sifted through a lot of the theme's files.
I can't find where this line is being added to the site. The line "<center>*bad link here*</center>" is being inserted right after the header and right before the closing body tag, on the home page only. The link in question is actually linking to naughty files inside a directory within the wordpress installation. It's not even taking users to an ouside site as far as I can tell.
I don't have FTP access to the wordpress directory yet, but I've requested it. I have very little experience with wordpress hooks etc, and am hoping someone can help me find a starting point in weeding out this unwanted link.
Thanks in advance!
WordFence is the best security plugin for WordPress. I'd recommend you follow the instructions at https://www.wordfence.com/docs/how-to-clean-a-hacked-wordpress-site-using-wordfence/
Another good resource to read is https://codex.wordpress.org/FAQ_My_site_was_hacked
I recommend you search all the files as norlesh suggested. If this was my problem I'd use Jetbrains PHPStorm to search all the files. Another much cheaper solution would be to use Textpad - https://www.textpad.com/
It's also possible that the link has been inserted into your database. If so you won't find it in your files. You'll have to search the database. Use a program like phpMyAdmin or MySQL Workbench to export the whole database to your machine. Then search the sql file for the URL. Alternatively use https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ which is a handy tool you upload to the server. From there you enter db login details and search the database. Note if you use this script you should delete if off your server when you've finished using it, it's a huge security risk.

CSS Icons are working locally in the app, but are not showing on Heroku?

So I have this app, just deployed on Heroku: http://jobsboardd.herokuapp.com/
And as you can see, instead of some fancy icons there are some strange symbols(rectangle)? I know it's a common thing with ruby apps, and I couldn't find anything related to php.
And according to the html code, every css file is loaded as it should. So what can be causing it and how i can fix it?
As I've check in the site's code, you are using HTML Kickstart Toolkit. The Icons that you are looking for belongs to another plugin called font-awesome. See if all the files in the css and fonts are accessible and mapped correctly. I've noticed when I check in the browser's developer console that this image is missing so its possible others are not accessible as well.

New to WordPress - editing existing theme

Forgive me if this isn't the right environment to pose a question of this nature.
I've just been assigned a project to create a site in WordPress based off of a purchased theme of similar structure. This is my first time working with WP, so I'm a bit overwhelmed with where to start.
I'm used to only working through a text editor, but WP obviously has a dev portal online that formatting and content can be built through.
So far I only have my theme imported and activated on WP and the PSDs for the site-to-be.
Should I be doing my editing/formatting/content-building through this online portal? My text editor? A combination?
Thanks in advance for any knowledge you can shed or articles you share!
If you're talking about using the Appearance Editor, use extreme caution. If you mess up a .php file, you can blank your whole website:
Be very careful editing PHP files of your current theme. The editor does not make backup copies. If you introduce an error that crashes your site, you cannot use the editor to fix the problem.
I would strongly recommend that you only use your text editor, and upload your changes to your WP server. Also, make sure you have backups, so that you can revert to a working copy if something goes wrong.
One article that I found on the topic:
Editing your WordPress Site 101
Repeat with me: Never use the built-in WordPress file editor. I won't bore you with all the reasons the built-in editor is a bad idea, but here’s the #1 reason: If you get a white screen of death, there's no way to access your site via wp-admin anymore.
It's a bit of a paradigm shift moving from standard text editor web development into the world of WP. Here are some points to help you along:
You should download/install a plugin called Synchi. This will make the WordPress text editor much more robust. It also allows you the ability to access and modify the WP theme files directly thru the dashboard (Appearance > Editor).
You can use an external text editor and jump back and forth, but I find it easier to stay inside the WP dashboard once you have Synchi installed. I only use Visual Studio if I'm coding something more complex and I want to see Intellisense.
If you are going to be making major changes to your base WP theme, you should create a "Child Theme" and work off of that. http://codex.wordpress.org/Child_Themes
There are millions of articles on how to get started with WP, so I'll let you Bing/Google that. Just keep in mind there's a bit of a learning curve so just BE PATIENT - you'll figure it out quickly enough!
I have to agree with the above response - you should avoid using the Wordpress editor for modifying theme files. Use the editor for creating pages and posts, only.
If you truly need to understand Wordpress, you should begin by understanding how it works. Unlike a static html site, Wordpress is created by a combination of php files which create parts of the final page (displayed to the user). Understanding the basics of how wordpress loads files will really help you get started. (tons of resources online)
Find a good text editor (or a free code editor like NetBeans), then learn how to sftp or ssh into your webserver so that you can edit theme files in your code editor.
Once you have that figured out, and understand how Wordpress loads files, you can begin modifying the theme to your PSDs, or create a child theme and do the same.
The point made by the above poster is quite valid... if you miss a tag or some other php error causes a 'white screen of death', you'll not be able to load the wordpress editor (because it's broken) to fix it. Whereas with an sftp connection you can still modify the file, then push it back to the server and reaccess your admin editor.

Wordpress update cause visual editor blank

I updated my wordpress website version with 3.9.2. After updating when i try to add or update any page or post, visual editor tab shows blank. It does not display toolbar buttons or page or post content. Text tab works fine
I tried following solutions provided on different sites with no luck
1) clear browser cache
2) deactivating all plugins
3) change to default theme and again change to desired one
The people who had the same issue had cured the problem by doing one of these suggestions:
1) Install “Use Google Libraries” plugin
2) Add to your wp-config.php file:
define( ‘CONCATENATE_SCRIPTS’, false );
3) Download a refresh version of WordPress from WordPress.org and via ftp replace /wp-includes/js/tinymce folder
4) Download a refresh version of WordPress from WordPress.org and via ftp replace /wp-includes folder
I tried all above solutions but no success :(
I also refer following links but could not find solution
Wordpress Visual Editor broken
Visual editor not working in wordpress 3.8.1?
I have attached screen-shoot for visual editor tab and text editor tab for one page
Please help
I had this issue on APlus.net Hosting and had one heck of a time fixing it. All the text in the Visual Editor was white, and I couldn't get to the HTML tab. The Visual Editor was missing all the formatting buttons -- it was just a white empty space.
After trying everything listed across the web without success, I was finally able to track down the culprit on APlus hosting. It turns out APlus hosting injects their own analytics tracking code into even the WordPress Admin pages. The code for their analytics wasn't written properly -- the code was missing a final ending apostrophe, which resulted in breaking all the code that came after it. In my scenario, the injected code broke the Page Editor TinyMCE JS code.
I checked the Google Chrome inspector to find the error in the code, and after talking with a Tech Support rep at APlus I was able to fix it by deleting the analytics file on the server via FTP:
/private/.wmcnum
I hope this helps. If anything check out the Google Chrome inspector and look for errors. If it's something you can't change, definitely get in touch with your hosting provider.
I've seen an issue like this before. For me, the site we were updating had many out of date plugins. The one that caused our issue was WP Polls. Something went wrong during the update process, and certain files were missing from the plugin directory. I kept a backup of all of the files from before the update, but even re-uploading them didn't fix it. We ended up removing the plugin that was causing the issues and re-installing it. If you can narrow down which plugin might have some discrepancies, then I'd recommend backing everything up (including your database), deleting the plugin, and re-installing it.
If it was simply a WordPress update, it may be that not all of the WordPress files copied over. If you can get a fresh install of WordPress 3.9.2, you can compare the differences between those files and the files on your site. If you're getting an error from somewhere in wp-admin, I'd start my check there.
This is the solution that worked for me:
“Use PHPMyAdmin (or another database editor) to search inside your WordPress database in your “wp_options” table for the record called “can_compress_scripts”. and if it has a value of “1” for the “option_value”, change this to “0” and save the change. You will find your editor working again! (Note: Sometimes this record won’t even exist, so in that case you need to add it. Look for a WordPress database that does have it in order to see what you need to add.)"
original answer by digbymaass:
https://wordpress.org/support/topic/visual-editor-missing-buttons-not-working-white-text-help-1/
In my experience I've had some problems with the tinymce editor. Some of my clients reported they've 'lost' some of the buttons in the editor (or all of them).
I found that disabling emojis with the tiny_mce_plugins filter not also disables emojis but half the buttons in the editor.
Maybe you have somewhere in functions.php this line, just comment it and refresh cache. Let's see if that helps.
add_filter( 'tiny_mce_plugins', 'disable_emojicons_tinymce' );
I checked all over about this. I could not edit or see text in wordpress posts or pages. It seemed to narrow down to the tinymce plugin where I found errors through the Chrome console. I tried a number of things without luck. So I disabled tinymce and all is running smoothly. How simple for a problem with so many variables and options for a fix.

Categories