Block.json editorScript path references plugin directory - wordpress

I am using block.json in a WordPress theme for each block withhin but the editorScript is referencing the plugins directory and not the theme.

For themes, you should use theme.json, the newly embraced practice for defining properties for the block editor. Part of theme.json provides for individual blocks and the contents are what you are using for block.json. I think block.json should be reserved for use in plugins where it defines the settings of individual blocks. Use theme.json for defining global settings, including blocks, if contained in the theme.

This behaviour was reported as a bug and will be fixed in Wordpress version 6.0.
Github pull request:
https://github.com/WordPress/wordpress-develop/pull/2494

Related

Where to put the files when setting up endpoints for wordpress REST API

I'm trying to set up some custom endpoints using the WordPress REST API. But I can't figure out where to put the files so it does not disappear when for example, updating plugins, themes or WordPress itself.
So I guess I can't place them in the Theme im currently using, or in the plugins/rest-api folder.
Anyone knows where to put the files?
Consider setting up a child theme: https://codex.wordpress.org/Child_Themes
Or, write a simple plugin: https://codex.wordpress.org/Writing_a_Plugin

Transfer the code of a custom plugin into a theme

I am working on a new project on WordPress.
I am developing a new website for a client based on their actual site (developed by an other team).
So, I decided to create a new WordPress theme and to use the existing content (client's request).
However, this supposes to reuse the custom plugins, in order to not re upload the pictures and the articles by hand.
I would like to include the custom plugins into the new theme. However, the plugins folder is outside the theme folder. So I was wondering if you have an idea on how I could transfer the code of a custom plugin into the new theme.
Thank you in advance.
What custom plugins are being used to handle pictures and articles? Uploaded files should go to /wp-content/uploads and all data is stored in the database. Removing the plugins might make the data inaccessible, but it shouldn't disappear.
Why are you moving functions from plugins to a theme? Or are these plugins inside of the /wp-content/themes/ folder? The way you handle the two cases is very different.
If you need to copy certain functions into a theme, you can move them into a functions.php file (or a functions.php file that calls to other files in that directory) in a child theme. The WordPress Codex has much better documentation on child themes than I could ever outline here. Placing the functions into your main theme is a permanent change and is not recommended when you're dealing with functions that are better-suited to plugins.
If you're copying plugins from one theme into another, you might want to look at plugin dependencies using TGM Plugin Activation.

Joomla css file rewrites it self

I was wondering why .css file rewrite itself on Joomla.
I have bought Joomla template. In template manger under general settings I am using Development Mode On. If I use Development Mode OFF I am not able to change .css files.
For example: I am using theme which is located in t3-assets/dev/ theme i choose
When I use On mode I find section I want to change, it works. But after some time it rewrites it self. I was wondering how to prevent that if possible?
Some templates are overwritten alone , go to your server and take off the writing mode in the template folder.
My guess is that the template is using LESS, so CSS are compiled each time you modify LESS. If that is the case, you should not prevent it, but find the correct way to include your modifications (probably there's a "custom.less" or similar file for that).

Overriding plugin functions from a theme

There is a plugin that has all of its presentation functions declared so that they can be overriden. I.e.:
if (!function_exists('show_thing')){ ... }
How should this be done? I tried declaring the function in my themes functions.php but it was already declared by that point of execution.
If I create my own plugin with the method declarations then how can I ensure my plugin loads before this plugin does and functions are definitely overriden?
The easiest way to do this would be to use a Must Use Plugin. Create a folder called /wp-content/mu-plugins. Any PHP file in this directory will be loaded (they do not have to be activated) and will be executed before the activated plugins or your theme files (including functions.php). Use a file here to define the functions that you want to override from the plugin.
Check out this diagram for more info on the WP Core load order: https://wordpress.stackexchange.com/a/26622/20880

drupal based menu

I built a website with a menu using drupal.
My question is how do I change slightly the design?
Do I have access to the css files? where?
Can I change the design using drupal?
If you used the default Drupal menu, you'd need access to the file system, specifically your site's theme files, to update the design. If you used a core theme, the theme would be in a subdirectory of your site's /theme directory. If you used a contributed theme, your theme should probably be located in a subdirectory of /sites/all/themes.
If you're unable to access the files but can somehow install modules, the following modules may help somewhat:
Sweaver
Live Themer

Resources