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
Related
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.
So I'm developing a Wordpress plugin, and I'd like to include the code from the init.php file to my plugin.php file.
My plugin does contain a working hook:
require_once plugin_dir_path( FILE ) . '/src/init.php';
To be exact this is a wordpress gutenberg block plugin. I have used this project to start:
https://github.com/ahmadawais/create-guten-block
So as I have asked above, is there a way to implement the code inside my plugin.php file? And if so, how?
I'd like to achieve this, so my src folder would only contain files that have either .js or .css extension and to store anything plugin related php code in one file.
I recently installed ACF Date and Time Picker plugin, and according to the installation guidelines, I copied the acf-date_time_picker folder that comes along with it inside my themes directory, alongside the functions.php file. Also, as per the installation guidelines, I copied the following code snippet inside my functions.php file:
<?php add_action('acf/register_fields', 'my_register_fields');
function my_register_fields()
{
include_once('acf-date_time_picker/acf-date_time_picker.php');
} ?>
The basic idea behind doing this was to include the acf-date_time_picker.php file inside my functions.php file. And since that file is included inside the acf-date_time_picker folder which is alongside functions.php file, I included the path to be included as
'acf-date_time_picker/acf-date_time_picker.php'
However, this is the error I'm encountering:
failed to open stream: No such file or directory in /opt/lampp/htdocs/wordpress/wp-content/themes/twentyfifteen/functions.php
What seems to be the problem here?
EDIT:
Including screenshots for better understanding of my directory paths:
You're using underscores _ instead of dashes - in the folder name
include_once('acf-date_time_picker/acf-date_time_picker.php');
The folder name I'm seeing in the first screenshot is acf-date-time-picker
So try:
include_once('acf-date-time-picker/acf-date_time_picker.php');
Go to Admin->Appearance->Editor and
select a different theme from the dropdown on the right. Edit
its functions.php and see if you find any of the bad code there.
hi
my drupal site is http://test.example.com
i have a template.php file in my theme folder
define('SITE_ROOT','http://example.com/abcd/');
i am using this SITE_ROOT for my custom functions
but echoing SITE_ROOT gives http://test.example.com
how is this happening.
plz help
Look for define('SITE_ROOT' in the whole drupal source code; it's probably defined somewhere in index.php or the config file.
thank you guys
i find the solution . i defined the SITE_ROOT in settings.php file and everything worked fine.
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.