Essentials Theme - Child or Clone?

Re: Essentials Theme - Child or Clone?

by Mark Roebuck -
Number of replies: 7

Thanks Mary.

I have made those changes but the issue remains.

The Essbist theme installs from the Notifications message with no issues.

I can select the Essbist Theme in Themes Selector successfully

However it does not show as a theme in the Themes dropdown (see attachment), to allow me to tailor it separately to the main Essential Theme.

Regards

Mark.

Attachment Capture.PNG
In reply to Mark Roebuck

Re: Essentials Theme - Child or Clone?

by Mark Roebuck -

Regarding my last post on this subject (above), could anyone direct me to the files I might be looking at which determines how the new child theme might show in my list of themes.

Regards

Mark

In reply to Mark Roebuck

Re: Essentials Theme - Child or Clone?

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

Does your theme have its own settings pages? Only the code in the config file you copied is still pointing to Essential's config

get_config('theme_essential', 'enablealternativethemecolors1'

Have you renamed all the relevant places in all files to match your theme name?

In reply to Richard Oelmann

Re: Essentials Theme - Child or Clone?

by Mark Roebuck -

Hi Richard

Thanks for the feedback.  I followed the instructions on the page link which Mary offered.  This instructs only a small number of changes, so no, I haven't changed every reference to Essential.

I would expect my 'child theme' to be as configurable as the original theme (at least that is what I am trying to achieve).

I plan on spending a few hours on it tomorrow.  The problem is your last comment "Have you renamed all the relevant places in all files"... the problem is I don't know what is 'relevant' and I don't know what files are relevant, hence my question for guidance on this bit.

Thanks for your help.

Mark.

In reply to Mark Roebuck

Re: Essentials Theme - Child or Clone?

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

OK - I think (but could be wrong) that the issue here is that Mary's original post and links quite rightly states

"make a Minimalist Child Theme which would 'inherit' all the code and settings from the parent theme" and the link to the decaf-green minimalist child theme does not have its own settings page, but inherits all settings from the parent. Which doesn't seem to match what you are requiring, if you are saying you want a settings page for your theme - which is what that theme list in the Admin menu is, links to theme settings pages which yours currently doesn't have.


I think your options right now are to

1. work on adding your own settings page and determining everything that is impacted by that and porting any relevant code sections across from Essential into your theme because you would have to start by replicating all the settings in Essential

2. not worry about settings and make any changes you need in a custom css file instead

3. go back to the beginning and do a full clone of Essential, renaming every instance throughout your theme

Personal opinion (emphasis on the personal, not saying its right, but would be the way I would work best) - I would be going for option 3 if I wanted settings pages, or 2 if I was happy to make my changes in the background code (but that doesn't give you the settings page).


Richard

In reply to Richard Oelmann

Re: Essentials Theme - Child or Clone?

by Mark Roebuck -

Thanks Richard.

I took your advice and cloned the theme completely.  There is not much advice online about how to do this, so I spent some time (using your guidence) and worked out the best way to do this.  I have included a step by step guide below to help anyone else wanting to do this.  To be honest, once you know how it is done it is very easy and takes approximately 10 to 15 minutes.

Instructions:

1. Grab a FTP programme (I used Filezilla) and copy your base theme folder from the 'theme' folder in moodle to your local drive and rename it to your new theme name on the local drive

2. Grab a copy of CodeLite from codelite.org, Install and open it.

3. Click on the Workspace tab in CodeLite

4. Drag a copy of the theme folder that you have just copied into the workspace - you should now be able to see the full folder structure in CodeLite.

5. In CodeLite go to Search-> Find in Files -> Find in Files ... (you can press Ctrl - Shift - F)

6. In 'Find What' = adaptable (or your base theme name)

7. In 'Replace With' = adapt_new (or your new theme name)

8. In 'File Mask' select the option which includes .php .js .css (it includes many more too but this is OK)

9. In 'Look In' select <Entire Workspace>

10. Ensure 'Match case' is ticked

11. Ensure 'Match whole word' is unticked - (this ensures all variable names are changed)

12. Click on the 'Replace' button

13. Wait until the software has found all Matches (this only takes a few seconds)

14. In the 'Output View' click on the 'Replace Marked' button -

 ** Steps 5 to 14 replace all instances of your old theme name with the new theme name in all of the code structure. 

15. Repeat steps 5 to 14 again but this time with capitalised search and replace strings e.g Adaptable and Adapt-new - this isn't essential, but helps you spot the new theme in the admin panel

16. Click on every folder in the workspace one by one and look for either folders or files named with the old theme name and rename them to the new theme name (I found files in 'jquery', 'lang/en', 'lang/es' and 'style' but this varies for each theme) e.g. "theme-adaptable.php" becomes "theme-adaptnew.php" - be sure that you get them all so click in all folders and subfolders.

17. Exit CodeLite (Save and Exit if asked)

18. Using your FTP programme copy the new theme folder back to your 'Theme' folder on your server

19. Once the move has completed Sign In to your moodle site as Admin

20. Click on 'Notifications' and finish installing the theme.

Once this is complete, you should now see your new theme in the Appearance -> Themes section of your Site Administration.


I hope this helps.


Mark.



In reply to Mark Roebuck

Re: Essentials Theme - Child or Clone?

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

There are instructions on how to Clone a Moodle theme, it's in the README.txt of the Clean theme directory, I know because I wrote it!

The only difference is that Clean was originally the Default theme shipped with Moodle, and so is a very basic theme, whereas Essentisl theme is anything but, that is why I thought the Decafe minimalist theme idea is a good way to learn.

There is a section of that tutorial that talks about the settings page, and renaming the code to your theme name, obviously you must have missed that line.

Cheers

Mary

In reply to Richard Oelmann

Re: Essentials Theme - Child or Clone?

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

You are very wrong Richard as the Decafe green theme DOES have its own settings page 

https://github.com/lazydaisy/moodle-theme_decaf_green/blob/master/settings.php

And as I mentioned to Mark, there is a section about the settings.php in the tutorial I had linked to.

The problem now that Mark will have, having Cloned Essential theme, are that the changes that Gareth makes in the future will need to be added again and again!

Thanks!

Mary