Share wordpress template between themes - wordpress

Is it possible to share a template file between WordPress themes?
If so, where should I locate it?
I didn't even manage to share a simple myfunctions.php file between theme templates.
I tried putting the file in the wp-content/themes folder, but the
include('../myfunctions.php');
fails to find the file. Am I overlooking something really simple that prevents this? Thanks.

AFAIK you can't "share files" between templates. You are looking for plugin functionality.
However, if there is a WordPress specific way for doing this I would like to know too.

Related

Theme in WordPress

I'm trying to modify a theme in Wordpress, I'm using it in a local server, but when I modified the style page of the theme, I don't see the result in the page.
My question is if someone knows How to fix the problem or well, How to modify the theme, but with really changes.
Make sure that no caching plugin like WP super cache or WP Rocket is enabled. Finally, make sure the style.css file is writeable by the server with permission like chmod 755.
If the above does not help, you can use a custom CSS plugin (https://en-gb.wordpress.org/plugins/simple-custom-css/) and add your CSS code using its interface (cleaner and less hassle for everyday users).

drupal_get_private_key equivalent Wordpress

I'm trying to convert the theme from Drupal to Wordpress, I don't know a lot about drupal, so this function "drupal_get_private_key" confuses me a little and I can't really find a lot of documentation about it. Could someone explain me what is this function about and how could I do this in Wordpress?
Thank you for the help
Drupal uses this to generate the paths to files* (its used in other stuff too, but in themming I believe its the main reason).
*These files are the files created by users, not the files in the theme folder. The folders are configured in the admin and, when an user uploads a news picture, for example, it will be placed in the configured folder.
You problably just want to find another way to find these paths.

wordpress theme doesn't appear

I'm having a very basic problem: I'm trying to create a new theme for a wordpress installation locally on my computer.
I've created a styles.css and index.php file and put it in a folder in wp-content/themes. But it doesn't appear in the Wordpress themes page.
As a test, I made a change to the description of one of the existing themes (Twenty-Ten) in its style.css, and refresh the Wordpress themes page, but the old description continues to be shown. This suggests to me that I'm simply using the wrong folder, but that's not possible! Any ideas on this problem much appreciated.
UPDATE: In fact, even when I delete Twenty Ten from the Themes folder, it's still available as an option in the Wordpress backend, and I can activate it... Very strange...
G
I agree with your diagnosis. You are either looking at the wrong folder or in fact the wrong computer. There's no other way that you could change the theme to one that has been deleted.
I suggest that you confirm you are in the same universe you think you are in. Create a simple file localserver.txt in your WordPress directory and then confirm that you can access that file.
If you can't, you have your answer. You are somehow accessing a different location.
If you can access that text file, you need to go further and look to see if something like the site url setting is redirecting you to the live site, without you realizing it, when you access wp-admin.
Beyond that, I'd need to know more about your setup. Something like having www.example.com in your /etc/host file and not example.com can cause similar confusion...
Are you using Wordpress Multisite?
In that case you have to 'enable' that theme in the Network admin manager

Drupal Theme editing

Hey I accepted a drupal project, I am experience with PHP, HTML, but not so much Drupal. I am editing the look of the page. So not to much php is needed. However I was provided the ftp and site drupal admin. How do I go about editing css, as of now the ftp file are read-only, and I cannot edit them. Thank you.
Drupal works from themes.
ftp into your site
find the "themes" folder where you installed Drupal
each theme will be in it's own folder ie: garland, bluemarine etc.
open appropriate theme
depending on the theme you should see a style.css file
drag the file down, edit and put back online!
done!
Edit: also I should note, that if you are wanting to edit the CSS from the Drupal Admin it's really only supported on a per theme basis. So if that theme has this built in. I know some themes do, Fusion and Zen.
You should have an FTP write access. At least for sites/all/themes folder, where You should put Your custom theme.

No access to wordpress functions from plugin files

I came across this problem when I was creating a plugin. I cannot call(access ) wordpress default functions like wp_get_current_user(), $wpdb->get_results(), admin_url() etc. from my plugin files. I can access them from my main file of that plugin in which plugin description is given. But I cannot access them from other plugin files. At that time I heard that if we create a new file functions.php and put these code in that file inside a function I can access all wordpress functions. I did so. But now I cannot access that new function. How can I solve this problem? I think you guys understood what I said. Please help me.
#Jan : I got the required thing. I just put require_once('../../../wp-load.php'); in my plugin files and now can access all wp functions from there. Any ways thanks for your reply.

Resources