I'm trying to remove the GTM installed by previous site owner in the header. However, I cannot locate the header.php file under Theme Editor.
When I typed in the URL example.com/wp-admin/theme-editor.php?file=header.php&theme=mytheme, I got the message "Sorry, that file cannot be edited." I have the functions.php and page.php files, is there a way to locate the header.php or edit the with the other two .php files instead? I do have administrator access, so I don't think I got the message because my account lacks permission.
I've looked on stackoverflow to see if other people experienced the same issue, but people mostly ask to inject new script/tag in the header and work around that with a plugin when header.php is not available. I cannot find an answer for when header.php is not available, how to edit/remove the tag then. I know that not all themes include header.php and footer.php, but it looks like that is the case for a child's theme, mine is not a child's theme.
Related
I am working on a project (the first one) and got this error :
[I am NOOB and new]
First of all my directory is something like this: (Adding on main files)
[Yellow lines point to files and the purple one leads to a folder.]
I am working on the User Section right now.
I made a header folder and added a header.php file to it. which contains a header(): void. this header function basically has my navbar (few things are retrieved with DB). Also this same file is linked with .css and .js from AdminSection.
Now while making this function I was doing try and error on my user dashboard so it is now working 100% correctly as I wanted.
But when I included this function into another PHP file for let's say UserProfile it doesn't work anymore as all the included files in Header.php were working for UserDashboard.php (since it is in another directory which is working because of my try and error.)
I searched for a bit about this and found no solution but to make a header file for every directory which seems to be stupid.
Any solutions for it?
A Snippet from my header file if required
[The paths are working for Dashboard.php but not for files in another directory. I want a solution where I have only one header.php and it works for every file no matter its directory]
so i downloaded a website template, unzipped it, and uploaded it on my host on bluehost, just to test it out. I tested several, but one of them didn't work, and it seems it's because that one has a Index.php instead of a Index.html file. I did some research, and stumbled upon things like redirecting the site to the php file instead of the html and such. Also, something with .htaccess...i have a lot of questions regarding this, but for now i just want to know how to treat this index.php like if it was an index.html.
I searched for .htaccess to change the parameter to make it load .php instead of .html
<?php
/**
* The template for displaying the header
*
* Displays all of the head element and everything up until the page header div.
*
* #package Neve
* #since 1.0.0
*/
$header_classes = apply_filters( 'nv_header_classes', 'header' );
?><!DOCTYPE html>
<html <?php language_attributes(); ?>
I just guess that i need to change the above header or some alternative of it. Please help. Thank you!
Btw: my website: https://sumproblems.com/ (i hope it is allowed to link this here. if not, sorry!)
The thing is that you are trying to view a WordPress theme, without the installation of WordPress.
You need first to download and install WordPress on your hosting and then upload this theme via WordPress admin (very easy). Good luck with that and enjoy WordPress
As long as the index.php is the only file named index in the directory, the webserver will show it.
Not sure if you have tried this but, remove everything you've uploaded (in this case, the templates) from the main website directory (where you've placed the templates) and just upload the one with the index.php file. Usually, there's no need to change anything on the .htaccess file, as the web server will recognize that he needs to show that file in the first place.
About the location of the .htaccess file: It should be on the main directory.
If this does not work, post a link to Pastebin or any other service of your choice with the contents of the .htaccess file so we can take a look.
Recently I have created a wordpress theme starting by 0. I have detected that when I include the following code at the functions.php file: require get_template_directory() . '/inc/database.php'; to link it to a created database for my theme, the media libray doesn´t load properly.
I have other code lines referringo to a "includes" folder.
When I comment this line at the file functions.php "//", it seems that the media library loads again. It should be conflict somewhere but I dont know where. Could someone give me some advice, or let me know where to look.
Thanks a lot.
Youc can try
setenforce disabled
I'm working with an existing PHP web application. It's site structure is similar to:
public_html
include
header.php
style.css
footer.php
blog
I've installed Wordpress in /blog. I am trying to create a Wordpress theme using the dynamic elements of the external PHP app.
Here is an example of /blog/wp-content/themes/custom-theme/index.php:
<?php
include_once("../../../../include/header.php");
?>
The theme is not reproducing the header code. I've tried variations of the relative path, just in case, with no success. Are there other considerations I haven't taken into account?
If WordPress is in /blog, there's a convenient constant called ABSPATH that holds the path to that folder. So:
$inc_dir = dirname(ABSPATH) . '/include'; # /path/to/public_html/include
include_once "$inc_dir/header.php";
Or directly:
include_once dirname(ABSPATH) . '/include/header.php';
Seeing that you're already using the correct relative path, though, be sure to include that file where relevant. If you're including it in an html comment or something like that, you'll get unexpected results.
I believe the "file_get_contents" could work in this scenario too.
It could also be handy if the external php file is part of a different program.
"file_get_contents" is a php method which loads entire files into a string.
See us3.php.net/file_get_contents
A handy call in various situations.
I used this to embed an ASP menu inside Wordpress. See stackoverflow thread with an example here:
How to Include an .asp menu file inside a php file? (Wordpress Blog folder within ASP Site)
I'm currently working on a drupal theme but keep having problems with getting the theme to read the damn css file. I started off theming with the Framework theme, I tried organising the files on there for example creating a subdirectory to store the CSS file, change the setting in the .info file so it knows it's in the css folder, but it won't read the damn file.
Fast forward a few days and I've got 60% of my theme styled and layout-ed, so decided to port everything into a new theme folder rather than the Framework theme folder. Organised the folders and files, but again it won't read the CSS file whether I put it in a subdirectory or in the same directory as the .info file. It somehow worked once, but then went and hasn't worked again.
I've tried clearing the cache etc, but to no avail.
I'm working on a local wamp server. Drupal is latest version 7.
Any ideas how to fix this problem?
Thank you
Wich version of Drupal you are using? In Drupal 6 this works fine:
/* mytheme.info */
stylesheets[all][] = assets/css/master.css
stylesheets[all][] = assets/css/typo.css
This files are in my Theme folder
Folder: MYTHEME
File: mytheme.info
Folder: assets
Folder: css
File: master.css
File: typo.css
I know this is a bit late but maybe it will help someone else.
I'm using Drupal 7 and I attempted to add a javascript and stylesheet file in a custom module in the .info file.
module.always.js
and
module.always.css
It would load the first but not the second. I even put the stylesheet above the script in the info file and it would still just load the first file. Thought it was the directory and tried adding quotes around the file paths but that did nothing. Also thought it was the extra . in the file name but that didn't matter either.
The only way I could get both files to load was to remove them from the .info file and add a drupal_add_js and drupal_add_css for these files in the module_init() function.
No clue why that is the case but at least there is a work around.