Wordpress function.php - wordpress

I make some custom ShortCode in the funtion.php file of a wp theme. The theme is live and working. In the ShortCode i made, i made an error, totally my fault, after saving, the theme dont load, the wp-admin interface dont load either. So i am pretty much screwup with a malfuntion wp theme, and no way to WEB edit the error. By chance, i have a dreamweaver/ftp acces, i download the file, correct the error, and everything is up and running againg
The question : Is it possible to get ONLY ONLINE EDITING, and having a way to get the error, but still have acces to the admin interface to correct it, or your stuck to have an external editor... or force to write PERFECT code first time, every time...
thanks
N.B. if anybody use and onlie file editor that is fast and easy... no need for code hinting and facy html goodies, just open, edit, save.. that will be fine for me.. any name ?

This would depend on the particular error. If the error is affecting the core then it will not let you edit online. It is good practice to have your files backed up so if something id happen like you are describing you can easily revert back to a back up. I personally like to edit the files locally and then upload them. This allows me to have a local back up as well as edit files which have errors.

Related

My Wordpress is showing a blank page in the editor, how can I fix this?

I manage a Wordpress site for a client, after trying to resolve some updates I cannot seem to edit anything inside the editor anymore. Everything is blank (see image). The site itself is still up and working fine. Has anyone ever encountered this?
There are tons of reasons, why this could be happened. Like #jiali sent you a very helpful link, I would say to try and open the debugger: inside wp-config.php file search for define('WP_DEBUG', false); and change the value to true. Then, you propably would see what causing the error and where (either plugin or custom code, or maybe plugins conflict)
Okay so in this case the problem was (when I checked the error log) that the update was not properly installed. Deactivated the plugins inside PHP MyAdmin and then reinstalled Wordpress manually onto site.

Error displaying oEmbed Wordpress

I've a problem with my wordpress website. When I insert some url for being embedded, it's not working fine.
Here is the issue URL : https://www.duosia.id/windows/cara-mengekstrak-files-menggunakan-winrar-dengan-mudah
And here is the Screenshot :
When I try to visit the embedded url. It's return 404 not found. You can check the embedded url here, https://www.duosia.id/windows/cara-mengekstrak-files-menggunakan-winrar-dengan-mudah/embed/
I've try these common solutions.
Update everything including WordPress, the theme and plugins. Available updates appear in Dashboard > Updates.
Deactivate all plugins in case there is a conflict. If the problem goes away while all plugins are inactive, then reactivate them one by one to determine which is causing the problem.
Switch to the default theme (such as Twenty Thirteen) then try to do what was not working. If the problem remains, it is a general WordPress or hosting issue. If it happens only while using our theme, please let us know.
Clear cache in both your browser and in any caching plugins that you are using (also disable services like CloudFlare, if used with your website).
Revert code changes if you have modified the theme’s code. If using a child theme, reactivate the parent theme.
But, seems no one work.
The WordPress post embeds don't seem to be working on your site.
This URL shows a live example of the problem:
https://www.duosia.id/windows/whatsapp-for-pc/
The two embeds present in that URL are returning a 404, therefore, oEmbeds are not loading properly and showing the 404 page:
https://www.duosia.id/windows/facebook-messenger-for-pc/embed/#?secret=kMPv636bx1
https://www.duosia.id/windows/line-for-pc/embed/#?secret=65m4VpxiYi
Have you tried testing those URLs in the plugin "Rewrite Rules Inspector"?
You should see something like this for any of the "embed" URLs:
index.php?name=$matches[1]&embed=true
Also, have you tried flushing the rewrite rules in WordPress or maybe setting the permalink structure to a different/default one (right now you seem to be using a structure of "category/post-name") to see if it changes anything?
For the file that you are embedding, are you uploading it to the Media Library or some other plugin?
First I would check on the server to verify that the file you are looking to access does exist.
Once you know that the file does exist, then repeat the steps you have listed again.

The whole wordpress website got RESET

My wordpress blog was working perfectly fine, until one day when suddenly my blog got down. All I could see was a blank white page. I still don't know the reason.
But initially, I was able to figure out the Debug messages, which were some compatibility issues between prototype of function Walker() and some theme function extending Walker(). So, I somehow managed to resolve those issues, by changing the theme function prototype.
But still, I could only view a blank page without any error. Then, I went through my child theme files and I found that there was some PHP code written to upload image file in child "style.css". Fortunately, I had backup of my Blog so I restored my child style.css.
After so many efforts, I still couldn't restore my complete Blog.
Although, All the posts and everything is there in DB, but I can't see any post on my Blog and Admin panel. It seems that my created categories are no longer there in Admin panel, when I restored theme.
Can anyone please help me to find out...
Why it happened and How my blog got reset ?
How can I restore my blog and reflect all my posts from DB to Admin-panel & Blog ?
It looks like somebody hacked you up. And, edited some files on your server.
Wordpress, actually doesn't offer any backup features. But, most of the web hosting services have a usual backup option. So, you might consider that.
Or, if your Wordpress database is right in place, as before, then you the possible error is that your Wordpress core files are corrupted or edited by anyone. So, you might consider, deleting your Wordpress and reinstalling it, (without deleting your databases). This would not affect your blog at all, because all Wordpress information is stored in the databases. But, remember to backup the files of wp-content folder and copy them to your new installation.

wp print_thumbnail function is not working

wordprees print_thumbnail function is working correctly on testing server but it's not working on online server and giving wrong image path such as */var/www/vhosts/vinehospitality.co.za/httpdocs//wp-content/uploads/2011/12/slide-10-108048_56x56.jpg*.
So kindly help me to get proper url.
Link of website: http://vinehospitality.co.za.plesk15.wadns.net
Same problem is found in hosted on this server.
Regards
Neeraj
Not only did it work, it was SO MUCH easier for me.
Simply, delete whatever custom link you have in Media Settings. If you don't have one just put anything there..
Then save, again, put back the original path you have before, save.
Worked!
Somehow it seems wordpress reads the wrong values when you move servers and you don't resave media settings.
POSSIBLE FIX 2
Look, I've seen this problem on other threads and on other websites and no one gave information that helped most of the people with this issue, so since I somehow got my broken site to work, perhaps it will help the others who did not get their problem solved.
Here's a little background... I needed to move a wordpress site located on a dev server to the live server. They were different domain names of course. First of all, I should have followed Moving Wordpress instructions and updated the site url before I exported the database, but... I didn't because I'm obviously too cool for instructions.
In order to transfer the site, I zipped up the files and transferred them to the new server and unzipped them. Then I edited wp-config and pointed it to the new database.
I used phpmyadmin to export the old database and I imported it to the new database.
Then I ran a query on the wp_posts table to do a string replace on the guid field and replace all instances of the old domain name with the new domain name.
Then I checked in wp_options and changed 2 records to replace the old domain name with the new one. I think they were something like siteurl and home.
Everything seemed to be working fine except the theme was mangling the img urls, prefixing them with the absolute filepath.
I figured I must have missed some records in the database that give the print_thumbnail function whatever information it needs to output the right url for the img's src attribute.
I thought if I could change a setting somewhere and change it back, maybe wordpress would automatically fix the issue for me, and I was lucky.
I played around with several settings and what finally worked was:
I went to Media Settings and I unchecked Organize my uploads into month- and year-based folders -- I don't know if this had much to do with the fix.
I also changed the Store uploads in this folder to something like wp-content/uploads2. I never created that folder, but I just wanted to get it to overwrite whatever was controlling that value.
I checked the site again and there was a change to the html source... now, it didn't even give the img tags a src value... it was just like <img src title="blah blah" />, so I figured I was on the right track.
So then I went back and changed Store uploads in this folder setting and left it blank as it was originally.
After I did that, the img src values were correct.
Hope this saves someone some time.
Also, I should note, I played around with altering the file permissions for the wp-content directory. I wish I hadn't. I get the gist of file permissions, but I tend to try not to fool with them if I don't have to. Using Filezilla is a pain to change the file permissions because it takes forever. Unfortunately, as most clients, this one had a prior affiliation with their web host and refused to take my advice and host their site on a VPS that would be cheaper and allow me to use SSH and get work done much easier. I wonder if there's a fast way to chmod multiple files without ssh, I should look into that.
Cheers,
Will
Will's approach fixed the error for me, and was in fact the only answer that worked. This question is posted hundreds of times, so I figured I'd summarize the answer in short. I'll post the answer first and the research details after.
Login to WordPress
Goto Settings > Media
In "Uploading Files", modify the "Store uploads in this folder" to "http://www.yourdomain.com/wp-content/uploads2"
Notice the "2" added to the folder-name
Delete any entries in "Full URL path to files"
Save changes
Now your site should already show some images again
Do all this again but now change it back to "http://www.yourdomain.com/wp-content/uploads"
Save changes
This finally worked for me.
Gathering from other sources, this occurs mostly after moving a website from one location to another. Other fixes I did prior to this:
Within MySQL, replace the old URL in the GUID values in "wp_posts" to the new URL
Change "chmod" settings (it you never had any prior issues, don't)
Many other answers to this issue included changing chmod to give access to the files, which didn't do anything but crash the website. Other solutions would've been to change the code entirely to use a different function. I figured it's not broken, just missing a setting. Turns out that was the fact.
It worked for the domain http://www.in1week.nl, which runs on a modded DeepFocus template by ElegantThemes.com. The theme uses "timthumb" in the function "print_thumbnail()", which may have caused the issue. This reset the value needed to use the function.
I faced the same problem and had to look around a lot in search of an answer. After my host moved servers, thumbnails weren't appearing on the home page and category pages. Looking up the source showed me that the path generated for the thumbnails was incorrect. Instead of http://.. in the image paths, I was seeing absolute file paths in the server, such as /home/..
Couple of solutions that seemed to have worked for others did not work for me.
What did not work:
Changing permissions of wp-content/uploads and all the directories under it.
Changing media settings and again reverting back to original settings.
Using 'the_post_thumbnail' instead of 'print_thumbnail' function helped the thumbnails come back, but I am no programmer and could not figure out how to make the_post_thumbnail function work exactly as it was working with print_thumbnail
What worked:
In my many searches, I read someone saying that the problem was fixed by correcting the path for 'et_images_temp_folder' in the database. I ignored this for a while since I did not understand what it meant. Later, I searched wp_options table and found that it had the following entry.
option_name: et_images_temp_folder
option_value: /home/painteds/public_html/darter/wp-content/uploads/et_temp
When the servers were moved my home dir was changed from /home to /home3 Perhaps print_thumbnail was searching for /home folder, and was malfunctioning when it could not find it. Updating the database with the new value fixed the problem for me.

IE8 crashing opening WordPress with Gantry Framework installed

I got a problem that's driving me up the wall: I made a Wordpress Blog, using the Gantry framework for layout en several different widgets and plugins. Everything works fine in FF, Safari, and Chrome, but trying to open the site with IE 8 the browser crashes or in the best cases I get a message that the tab has been closed and reopened due to an error; after which the site is loaded fine. I try finding out what happens during the opening of the page, but the debug panel of IE doesn't point out any error!
Does anybody have clue on what the problem might be?
The website is: http://www.danielevecchiotti.it/
I suffered from the same attack today, so I investigated a bit:
That injection is done through the hole in one of the plugins, most likely through the outdated contact-form-7 plugin. Check if you have this folder in your wp-content/plugins directory - even if it is not activated in Wordpress, the very presence of it there is a potential security threat as the attacker can use the direct URL of the plugin faulty file to access it.
(source: http://wewatchyourwebsite.com/wordpress/2011/11/wordpress-websites-infected-through-outdated-contact-form-7-plugin)
Patching the hole: if you use this plugin, update it to the latest version which is not vulnerable. If you don't use it and just keep it deactivated (like I did), you can remove it at all.
It is also a good idea to prevent people from accessing your plugins directly. You can create a wp-content/plugins/.htaccess with the following content:
<Files *.php>
deny from all
</Files>
This might not work with every configuration, but usually plugins are only accessed in the code, not with HTTP calls so that shouldn't do harm to visitors' experience.
Restoring your site: If you don't have backup of your *.php files to restore them all from by overwriting your current ones, you need to search for every file containing the string specific to the malicious code, e.g. "eva1fYlbakBcVSir". Then you need to edit all those files - for every file, remove a long line from it's end.
Or if you're proficient with command line and, say, perl, you can build a regular expression to do the work for you.
What was the purpose of the attack? Obviously there were links to some Java plugin added to your site's pages by those code snippets. The plugin added is believed to be the following: http://www.microsoft.com/security/portal/Threat/Encyclopedia/Entry.aspx?name=Exploit%3aJava%2fCVE-2010-0840.KM&threatid=2147649278
However, I didn't manage yet to decipher the injected code fully - it's very well messed up and the reverse engineering is hard. So I can't tell for sure that apart from showing that Java plugin to visitors the exploit was doing nothing like reading users' passwords or removing some files (unlikely, but possible).
I can't find any information about that as well, looks like nobody traced the consequences fully yet.
Please share if you know more.
I finally found the problem: the site has been HACKED!
I noticed the index.php and wp-blog-header.php files modified on a strange date and time. Downloading the two files I found they had been compromised: a whole section of unreadable code had been added. Uploading the original PHP files the above problem was solved.

Resources