wordpress - how to access and edit index.php file - wordpress

Is there a way to edit the index.php file in wordpress?
Around the web i found a lot of post saying to go to appearance -> editor,
but I can't find this menu... maybe this feature was removed...
So how can I do it?

There are two ways you can edit your PHP files.
Method 1: Edit the file in your Installation Directory on the Web Server
(this is what Anoop Asok is talking about)
Go to WordPress Installation directory. Follow the path wp-content >
themes. Open your theme folder. In that you can see index.php file.
Edit it and save.
Method 2: Edit the file from the WP Dashboard
(This is easier and is what you were trying to do but that file isn't always made available by your theme)
Download, install, and activate the Synchi plugin (this is an awesome IDE and one of its nice features is that it will allow you advanced theme editing)
Go to Appearance > Editor . Now you will see the -themes- window on the right and you will have full access to all your theme files.
Double-click your theme and drill down until you find your file you want to edit
NOTE! You should avoid editing your theme files because they might be over-written next time you update your theme. Make a child theme and put a copy of index.php in there and work off that one instead.

Please do this.
Go to WordPress Installation directory.
Follow the path wp-content > themes.
Open your theme folder.
In that you can see index.php file.
Edit it and save.

Related

Why does Wordpress Customizer think my theme is broken?

I am creating a Wordpress theme. I have index.php in my theme's root folder. I have my style.css in a separate folder /css. I've got the beginnings of the design done and everything is working fine.
I now want to add some options with Customizer. I've begun to add some in customizer.php. I then go to check what they look like in wp-admin, click "customize" on my theme and get...
"The active theme is broken. Reverting to the default theme."
The theme was working fine up until that point. I've deleted and re-installed it a couple of times now. All is well until I click "customize".
The error message instructs me to check index.php and style.css, both of which are present. Could it be because style.css is not in the root but in /css? If so, how do I get Customizer to recognise this? My stylesheet has been enqueued correctly in functions.php. As I say above, the theme works fine until I get involved with Customizer.
When I click theme details, wp seems to think the theme is a child of itself too. It isn't a child of anything. I am using underscores starter theme and adapting.
What is going on with Customizer and how do I fix it?
The style.css is a stylesheet (CSS) file required for every WordPress theme. It controls the presentation (visual design and layout) of the website pages. In order for WordPress to recognize the set of theme template files as a valid theme, the style.css file needs to be located in the root directory of your theme, not a sub-directory.
There must be connection lost when you update resulting to broken themes or missing files.
You need to reinstall a theme :
There are two ways to install WordPress themes.
Method 1.) Direct Upload inside WP Admin Console
Method 2.) Using an FTP Client
Method 1 is just a matter of uploading the theme from your WordPress admin console.
Once logged in, navigate to Appearance → Themes and click the "Install Themes" tab. Click the "Upload" link and browse to the location where you extracted the package and upload themename.zip.
Method 2 is pretty straightforward.
Using an FTP client is recommended. If the term FTP scares you, don't worry. It's no different than moving files and folders. Filezilla is a free and trusted FTP client.
Extract themename.zip to your local machine
Login via FTP to your web server and navigate to the /wp-content/themes/ folder
Upload the entire themename folder and its contents. Example: /wp-content/themes/yourtheme/
Open your browser, log in to your WP admin section and (in the left column under Appearance) click the Themes link .Click Activate under the theme you just uploaded.

Upload theme button don't work in wordpress

I have installed Wordpress in my Godaddy hosting.Its working quite well except i cant upload a new theme. when i click Appearance > Themes and then add new nothing shows up. The only thing that shows up are the buttons featured , most popular etc but when i click them nothing happens. When i press the upload theme button nothing happens either. How do i fix this?
I have tried it switching the default theme, deactivating all plugin but nothing resolver the problem. Godaddy support says that i will get a conformatin mail after the installation process completed within 24hours. Its almost 24hours but i haven't got any conformation mail. What can i do?? Do i really need to wait for the conformation. i can visit my blog but cant upload any theme, whats going wrong??
You can add your theme directly in your Wordpress installation. For this go to public-html/wp-content/themes/ and drop your theme folder here. Remember that your theme files must not be in subfolders of the folder e.g. /themes/your-theme/theme-files-and-folders/
Had the same issue today and solved it using these steps:
Download the Theme .zip file to your machine.
In cPanel File Manager, navigate to your Themes folder. Depending on your hosting, path to Themes folder can differ a bit but essentially you are looking for public_html inside which you’ll find /wp-content/themes/.
Once you’re inside the Themes folder in cPanel File Manager, click on Upload and upload that .zip file you saved in Step 1.
Once the .zip file is uploaded, right click on the name of that file in cPanel and select Extract from the context menu.
Now you can refresh the WordPress themes page and you should be able to Activate it.
The issue was theme related. I just renamed my current theme and then the default theme was automatically activated. Then i was able to upload my zerif lite theme and its now working fine.
I have been through this issue and i have solved it!
it happens mainly when yu transfer wordpress database from another location!
Solution:
UNinstall and deactivate all themes! delete and re install! if you cant delete the theme due to modifications, decativate the theme switch to another new theme by installing from wordpress and then reverting back to old theme!
if the problem persists: Reset server!

how to install downloaded wordpress theme in xampp

I am trying to install a theme I downloaded from this website.
I am using XAMPP and I am not sure how to install this dowloaded theme using XAMPP.
I tried installing this theme with the zip folder (in zip format) in Wordpress but I get the error
” The package could not be installed. The theme is missing the style.css stylesheet.
Theme install failed. “
I found a similar on Wordpress website but they mentioned using FTP but I don’t know how to use FTP with XAMPP
I want to install the theme and test it out locally before I make it live or buy a domain name.
This is my first time doing this (I am a student) so I don’t totally know how things work together, don’t know if I am using the description/terms but I hope I described the problem well enough.
How to go about this? Any help will be appreciated.
Thanks
OK so its a bit weird that the theme you downloaded is missing the CSS file. When you upload it Wordpress is trying to find that file and failing. For now, let's assume that the creator of the theme put the CSS file in a different location than usual.
To install a theme manually via XAMPP do the following:
Locate XAMPP's htdocs folder. This is normally Applications>>XAMPP>>HTDOCs on Mac or My Computer>>C:>>XAMPP>>HTDOCs on Windows (I think - someone might need to correct me on that).
If your site is installed in a sud-directory in htdocs, go there. If not skip to next step.
Open the wp-content folder
Open the themes folder
Copy in your downloaded theme and extract it there (if its zipped)
Go to your Wordpress Dashboard and go to the Appearance button on the left and click Themes from the drop down. Find your newly installed theme and hit Activate.
That should do the trick unless your theme is missing some vital elements
(PS: what your are doing here - moving (theme) files from one location to another - is essentially the same as FTP. Difference is FTP allows you to transfer files accross the internet from computer to computer: say your computer to a web server hosting your site.)
Add this lines to your wp-config.php file
//** To add the direct installation of the themes **//
define('FS_METHOD', 'direct');
Then go to wp-admin and click on customize your site. Press on change button on the active theme and browse for your favorite theme from wordpress.org and install then enjoy

WordPress not recognizing theme in /themes/ folder

Having a really baffling issue with permissions, WordPress and theme files.
I have a fresh install of WordPress and tried uploading the theme I made for my client. It uploaded fine but it doesn't show up in the Manage Themes menu. I checked everything was uploaded and it was. Checked permissions (even set them to 777 at one point) and they were fine. But the theme doesn't show up.
Here are the different scenarios I've tried:
Using the Install Themes menu and uploading a .zip (failed)
Duplicate twentyten folder and contents (worked)
Duplicate twentyten folder and used my theme files (failed)
Duplicate twentyten folder and used my theme files and their style.css (failed)
Uploaded my theme WITHOUT style.css (gave missing style.css error)
Uploaded my theme WITHOUT style.css and put in twentyten/created one from scratch (both failed)
I'm on my clients MediaTemple hosting and I've never encountered this error. Their support has yet to get back to us.
Does anyone have a similar problem? Solution? It's possible I can give you FTP access if needed.
CSS Head (changed values but format and everything is still the same):
/*
Theme Name: Example Theme
Theme URI: http://example.com/
Description: WordPress theme
Author: Company
Version: 1.0
*/
Edit: Trying to access the folder through my browser results in a 403 error (works fine on twentyten). style.css can be viewed from the browser.
If you are using a MULTI-SITE installation of Wordpress, you have to first go into Network Admin, select Themes from the left menu and enable the themes you like to use before they can appear on the "Manage Themes" page in the Site Admin section.
Perhaps you are missing a required template file?
At the very minimum, a WordPress Theme
consists of two files:
style.css
index.php
http://codex.wordpress.org/Theme_Development
On Ubuntu 14.04 you can install the wordpress package simply using sudo apt install wordpress but then you have to set a link to the themes directory.
E.g. for your "newTheme":
ln -s /usr/share/wordpress/wp-content/themes/newTheme /var/lib/wordpress/wp-content/themes
I bet you have some special characters in your templates. This once drove me nuts to find.
Check your Template files and/or rename them until the theme shows up. I used a german "ö" in a templates name.
I had a very similar problem. Spent a few hours before I found that somehow when I moved my local site (probably using All-in-one Wp Migration plugin), a .htaccess file was created in the /wp-content folder. I don't remember what was inside this file but I think it didn't matter.
After removing this file everything was ok.
Is the theme folder name different than everything else? Is the Theme Name in style.css different than everything else?
I am guessing BOMs are the problem. They messed up my validation of a page once, as I tried to remove the BOM. Try using an editor and remove the BOMs. For Notepad++, the text editor I use, I just set the encoding to UTF-8 without BOM and saved. That solved my problem. Of course, your text editor may be different.
As I discovered at the end of tortuous troubleshooting, an old wp-config.php may cause newly installed themes to be undetected and invisible in /wp-admin/themes.php - I am not sure that you have the exact same problem but it looks very similar to mine and you might want to try your configuration with a wp-config.php newly generated by Wordpress.
Make a backup of your styles.css
Copy the styles.css file from twentyforteen to your theme folder.
Only change the template name at the top of the file
Re-load the themes page in WordPress admin; once you've seen it working,
Further-modify the new styles.css file as needed.
The problem could have been, that you uploaded it in .zip
Your php setting might disable the scandir. It may cause the wordpress cannot scan the theme folder
Solution:
find php.ini. You may run php --ini to get the php.ini file location.
Open php.ini,Search for disable_functions, then you may removescandir parameter.
Save and restart your php services.

Find the source files of Wordpress

i mean i want to see the source file of the main page.
when i click right click and choice the option view source, so i want to find
the "body" of the file,and edit it physical, which folder can i find it ?
thanks friends.
WordPress's HTML is generated by PHP in conjunction with CSS, so look in your active theme folder in wp-content/themes/yourtheme. You'll find all the parts of a WordPress theme: Using Themes « WordPress Codex.
WordPress runs on the server -- the "source" you're viewing from your browser is client-side, and is essentially the output of the WordPress PHP code that generates the pages (and some CSS transforms). In order to see the PHP source, you'll have to download it from WordPress's website yourself or look at your WP installation directory on your server.

Resources