Drupal theme does not change when it is modified - php

I am creating a drupal theme and use role theme switcher to change the theme according to user role
for the the role anonymous I've created a custom theme
the theme html script does not change whatever the changes I make
I've cleared the cache from performance

remove the cache from administrator->performance clear cache
change the default theme to new and fresh theme ( I am using zen) and run module and its custom theme
it may need modification in css or js files

Heed Drupal's unofficial moto when developing a theme:
Also, there are many base themes (Zen for instance) which have a setting to clear the cache on every page request during theme development. You turn this off once the theme is completed, but it's a nice feature when you're still working on things to avoid caching issues.

Related

Opencart theme development from scratch

I am creating the theme for Opencart 2.2.
While creating a Opencart theme do I always need to copy the files from the default theme? What about I want to create my own layout? Is there any good tutorial are available for creating a opencart theme without using the default theme?
Looking for your reply.
Thanks and Regards,
Chirag
If you are creating your own new custom OpenCart theme, use default theme folder structure. If you want to change/improve functionality of your template, you need to edit controller and models too.
But do not change core files. Always use virtual mode to modify files.
In OpenCart, there are four ways to modify its core functionality:
vQmod, OCMOD, Override Engine and Event Handlers
vQMOD / OCMOD / Override engine / Event handlers allows developer to modify files without changing any of core file. This means that if a modification is removed none of the original OpenCart files need to be restored or fixed.
Creating a new theme for OpenCart 1.5 used to be pretty easy - make a folder in the theme directory and copy only the files from the default theme that you want to change. And that was about it.
OpenCart 2 is now outdated, 3 should be used for new builds ...
OpenCart 3 brings new features, but creating a theme is a little more difficult.
There are instructions and a free downloadable template theme here:
https://www.antropy.co.uk/blog/how-to-create-an-opencart-3-theme/

How to prevent to lose a theme modification in WordPress when the thme will update?

I have the following problem. I have to modify a JQuery function into a file named custom.js into the theme that I am using for my website.
I have no problem to implement my customization to the function but my doubt is: What will happen when the theme will be updated in the future?
I am pretty sure that the file will be overwrite and that I will lost my customization.
How can I prevent this situation and maintein my customization?
What you're doing is forking the theme. Nothing complicated to deal with.
You should consider using a VCS like git or svn to monitor the changes you've made from the original theme, so you can apply them more easily to the latest released versions that the theme might have in the future.
You're right! All changes made to the parent theme will be lost on updating. Nevertheless, it is not a good practice to mess with the parent theme / core WordPress files. You never know where one may go wrong.
WordPress recommends the use of Child Themes for modifying an existing theme.
Note that this method is easier compared to the Version Control mechanisms like git or SVN. Moreover you could keep track of all the changes made by you.
Now that you're using the child theme, its easier to dequeue the custom.js file included by your parent theme using the wp_dequeue_script function. Then, use wp_enqueue_script to enqueue the file in your child theme with the necessary customization made.

Update WP theme without delete the old version first

I'm currently host my site with managed WP hosting (I have no access to my file directory). I use child theme that contains only style.css file (aimed to store the customization only) and I do not activate WP editor for security reason.
When I want to update my parent theme I should delete the old version first and my site automatically changes to other existing theme which is completely different.
To upload my new version theme it takes time about 1 minute and that means users will see my site with different theme while the uploading process.
My question:
How to update my theme without delete it first or is there a plugin I can use?
If there is no such a way, how to show error message ("Hey we'r currently customizing our site ...") during the uploading process?
Thanks.
if you are using the child theme then you can directly update as it does not effect your changes for child theme
and for showing maintenance there are many plugins that provides the maintenance mode functionality.one of theme is
https://wordpress.org/plugins/wp-maintenance-mode/
its show a template while you are in maintenance mode once done change deactivate the maintenance mode

WordPress child theme for admin only (development)

I'd like to restrict a child theme to only being visible to me, the admin, for development purposes. Then I can make changes, upload and view them live and on the site without other people seeing those unfinished changes. Once I'm done, I take the affected files and move them to the Parent Theme's folder to make the changes visible to everyone.
Is this possible with some kind of script through functions.php?
And I'm not just talking about enqueuing the style.css file, I'm talking about setting up a complete child theme with sidebar.php, header.php etc. and only have the child theme files being loaded for me, the admin, for development purposes. Perhaps a way to define the child theme directory, embedded inside a condition that checks whether the user is admin.
Thank you :)
There is a plugin that does what you are looking for called Theme Test Drive. I haven't used it before but I think it uses some filters to update the theme at runtime for logged-in admin users.
Essentially, you install your new theme and activate it using the plugin instead of the theme switcher in the admin.

How to make Wordpress theme editable by other users

I have installed a Wordpress theme in /wp-content/themes/mytheme/
I then applied this theme to a specific site. I am using Wordpress multi-site.
I want users who have access to the site to also be able to edit the theme from Wordpress.
Is this possible? How?
By default, only the super-admin has the ability to edit theme files in the WordPress multisite environment. In order to circumvent this default behavior, you will need to build and install a simple plugin and modify a WordPress core file. Instructions for doing so can be found here. Posts by jroakes and jrue contain the code you need to make the modifications. Keep in mind that updating WordPress could break the modification. Also be aware of the security risks involved.

Categories