How can I integrate the functionality of a plugin into my theme?


If I have created my own theme and used a few plugins in this theme, I would like to integrate these functions directly in the theme.


I use the plugin “simple search”. It’s in /user/plugins. Now I want my theme to have this function built in directly, so as an “inside-function” and no longer as a plugin. The functionality should then be in /user/themes/my-theme, for example in /user/themes/my-theme/plugins

How do I do this?

From static website generators I know that it works, because there you have the functionality of the plugin in the static version of the website.

The idea behind this is that my theme can then also work in other website builders that did not have the Grav plugin. Thus, another user does not need to install a new search plugin. He has the search function directly in the theme.

You can define dependencies for your theme in blueprints.yaml. Eg.:

  - { name: 'plugin-name', version: '>=1.7' }

You should have at least one dependency there already for the Grav version. I believe, in such case, when theme is installed, dependencies are too.

Yes, I know that. But this will only install the plugin you need in Grav. What I am looking for is a solution to integrate the functionality of a plugin directly into the theme, so that the plugin does not have to be installed. The result is a theme with built-in functionality.

I did some tests with gantry5 and the theme “Helium”. There is a “back to top” function built in, which jumps back to the beginning of a page. But the Grav plugin “Back to Top” is not installed.

Usually the functionality and the design are separated into plugin and theme. In my case, I want to break this separation and create a theme that brings a few basic functionality build in. Search, language switcher, back to top, back to the last visited page, home, print page and TOC. The functions are then fixed and cannot be updated.

I’m not really getting the point why would you want to do this. If you don’t want for plugins to update, you can lock the version in dependencies. Also plugins can provide not only functionality, but also some design elements and I personally think Back to Top is more of a design feature than some functionality and it’s a one liner to implement, so I wouldn’t say some theme has this plugin embedded.

If you still want to embed some plugins into your theme, I suppose you’ll have to go through the code of them and copy to appropriate parts of the theme (templates, assets, PHP, blueprints…) and I believe you’d still have to modify that copied code a bit to make it work

The idea behind it is the portability of a theme to another CMS. Of course, it’s all about very simple plugins that practically every theme uses. If this functionality is built into the theme, then it also works in another CMS. Otherwise, the user has to find and replace other plugins in the new CMS. Unfortunately, there is no CMS yet that can work with plugins and themes from various other CMS. Everything has to be rebuilt every time, for every CMS or static website builder. There is a lack of standards. The code is open-source, but due to the different programming methods, the CMS still remains a proprietary tool. It would be great if one day there was a CMS that could import plugins and themes from other CMS and use them with the help of an interface. And, as I already wrote, if simple plugins could be built directly into the theme, for example, search function, back to top, TOC, language switcher, little things. By the way, if you use a plugin to turn a Grav website into a static website, then the functionality of the plugins is also exported. So basically it works. And Helium has actually integrated its own “back to top”, as html.tiwg and CSS.

But maybe this is still the future dream of a person who thinks a little further :slightly_smiling_face:

One more additional observation:

Recently, more and more plugins have been appearing that optimize the performance of a website. I had installed one at WP, it was called “Optimizer”, or something like that. These tools actually simulate a static website. It has created an html file for each visited page. You could also create all html files at once, which put a lot of strain on the server. But it makes it clear where the problem lies, in server performance. The web hosts are struggling with millions of websites, the vast majority of which are probably not really helpful. But when people pay, the hoster has to deliver. But he does not want to, because it costs a lot of money. The tool could also generate minfy, i.e. compiled code files. If I understand it correctly, then all the code files used by the website building interpreter are languages, i.e. html, css, js and php. This is so because it provides more opportunities to in-time changes. But it puts a huge load on the server. So a possible solution is to compile the files, as already mentioned. However, the advantage of the in-time change is lost, resp. the files must be recompiled after a change. With a heavily used forum, this in turn leads to a high server load, because it has to be fast.

So, if we want to make sure that the hosters continue to serve us well, paid or free, then we have to reduce the burden. It means more local development on our own computers, less online changes, compiling files where possible and wherever possible, using a static website, with compiled files. A blog is a pretty thing and you can write something there every hour or minute and then wait for the comments. But you can also do this on facebook, or in another medium that is made for this. Web hosts should take this into account and no longer allow so many interactive websites by setting a limit, for example in % of all websites. This would prevent hosters from covering them with interactive and mostly useless websites. And we website operators can help by turning off comment functions, generating static websites and then simply installing a flatfile forum where visitors can leave their comments.

My website has recently become a static website, unfortunately some functions no longer work (search, social sharing), but that’s probably because I didn’t use the plugin correctly. The forum is now flatfile, a little easier, but no one gets there anyway. One should not think that one is so important :slightly_smiling_face: And anyway you can then link your fb to it, if this is what you like.

Sorry, I’m completely lost here. I really don’t understand what you’re trying to achieve. Solve server performance issues? Make single theme compatible with every CMS there is? Develop/find a static website builder, that would not break anything? Something else? :thinking:

1 Like

I’m sorry that you can not follow my reasoning :neutral_face:

So I’m trying to explain it in a different way:

Companies are increasingly using several CMS. Usually one of them is the central CMS (for example, WP). In addition, another CMS is used to solve special things more easily than would be possible with WP. For example, this could be to build a very fast website, using either flatfile CMS or static website builder. The reasons for this are simple, it’s about the money and the amount of work (which is ultimately the same thing).

So there is obviously a need to combine the functionality of different CMS. The following articles are about a pachwork of several CMS, but each CMS works independently for itself. Of course, it is clear that a company also needs more knowledge and more specialists for this, which in turn causes costs. Therefore, the logical next step will be to demand a real MULTI-CMS, which can offer the functionality of different CMS in one go. If a CMS has the options to work as a flat file or as a database CMS and also as a static website builder, then that would be a big advantage. And if the CMS can also use themes / plugins from other CMS, which are docked as “modules” and operated via an interface function (without changing the original module), then that’s even better! The big advantage of such a MULTI-CMS with integrated theme builder and plugin builder is that the content has only to be created once. I create a page or an article in the MULTI-CMS and choose the way I want to publish it, i.e. as a webpage in my database CMS, or as a webpage in my flat file CMS, or as a static webpage, or all three together. Of course, all this is done by the MULTI-CMS, since it contains all three functionalities.

I hope you now understand a little better what I’m talking about and why this also has to do with the host servers and their capacity, because it’s always about money, at least almost always. And companies want to make money, not lose, or they can no longer pay the wages of employees and you become unemployed.

One should try to always be one step ahead of the customer’s wishes and to develop a MULTI-CMS already now, because it will not be easy!

multi-cms integrated

Did you ever wonder why nobody did such CMS yet? I think because it’s basically impossible. It would still be a one of a kind CMS which still wouldn’t work with other CMSes. We have a saying - what fits everything, fits nothing. I personally first time now hear of companies using multiple CMSes. And I don’t really see the point - either you pay for multiple CMS management or you pay for server performance or you pay for other stuff - you still pay :man_shrugging: So I think you have a business idea here to fill that gap :wink:

Personally I wouldn’t use such CMS, because it sounds it would have way too many features, that would never be used. And I can’t imagine a website half static, half dynamic - just makes no sense. Caching basically mimics static website :thinking:

But you might be half way there if you install DB plugin for Grav - you’d have both flat file and DB CMS. I saw there were some static generator plugin for Grav too, so you could be fully there. I just see no point in this, sorry. Maybe someone else could advice better :confused:

I know that Grav already pursues such an approach, that’s why I’m interested in Grav. And the approach will continue to develop. There are also other CMS that go in this direction, WP for example. It has many plugins for static website building and also for exporting entire websites to other CMS, for example Grav. It’s just a pity that all developers then develop the same thing in parallel, instead of integrating what already exists. It would be more interesting. For example, you can also install a WP within a Joomla, I have read.

Websites can be a mixture of different technologies. Let’s say you have a website with product support, no matter what kind of products it is. There you have 3 functions that you want to fulfill:

  1. Online support with timely response for customers with a support subscription (a hotline, but without a phone)

  2. A forum for all users, even those without a support subscription.

  3. A documentation on the products.

Of course, everything should look like one piece, i.e. a theme, a branch. But number 3 you can build well as a static website, because there are relatively few changes (versions management). Number 2 must be more flexible, but it is not absolutely necessary to record all requests systematically, i.e. a flat file solution. Number 1 is database-based, because you want to analyze the support requests in order to better respond to the individual customer, for example with an offer for user training, or you want to know which of your supporters provide quick and correct answers to pay them a bonus, or you want to know where your documentation is not clear enough to adapt it in the next version. That’s why you need a database solution here, for better evaluation.

You see, it makes perfect sense to combine different technologies in one website and with subdirectories this is also possible without any problem. In the home you have a WP, in the directory for the forum a flat file forum, in the directory for the documentation a static website. No problem for the php server.

But ok, I think the developers have certainly recognized the idea and will stay on the way. You could form groups, for example drupal with Grav and Nikola build a MULTI-CMS together. Or WP and automad and pelican are building a second MULTI-CMS. 3-4 should be enough!

We just let it happen, the technical problems are always solvable, it’s just about the effort and the financing, but for this you have the special customer projects, where you earn with service, even if the software itself is free.

OK, I see your point how companies might have a chat, forum and docs, but I still don’t se how a single theme could help here. Maybe some header and footer, but everything else would still be completely different (apart colors) :thinking: I had also a page years ago with product listing and a forum - had absolutely no issues running page on a custom built CMS and a forum on a 3rd party solution. Simply added the same header to the forum as on main page and that’s it.

As you said, maybe some day 3rd party developers might end up with a proper static builder and DB interface for Grav, but I still believe these would remain as plugins :man_shrugging:

I can’t agree.

Small tools with separate concerns is generally a proven robust model.

As far as I can see, the problems you are trying to solve stem from a very disparate architecture and the choice of commodity hosts with limited resources. For example, with not much money and a bit more research you can find hosts that will handle a dynamic environment like Grav very comfortably.

Seems like over-engineering to get around minimal planning.

My 2c. Anyway, good luck.

1 Like

I see your concerns. I worked as a project manager for 15 years and was the bridge between the customer and the software manufacturer. That’s when you learn to understand both points of view, or you are not successful. Nevertheless, it must be recognized that it is the customer who sets the requirements and the software manufacturer who has to meet them if he wants to receive the project.

Of course, it is also a question of size. Personally, I am a very small person and I do very small, private projects. If you want a large order as a software manufacturer, for example the international documentation center of IBM in Denmark (I don’t know if it still exists today), then you should think in other dimensions. I had to deal with this center as a young engineer about 30 years ago and it was huge! I have no idea today how many millions of documents were stored there (in paper form) with how many hundred million pages…

Ok, but the customer’s wishes will produce the MULTI-CMS, just because of the lucrative payment.

In the meantime, I have at least found the time to design a non-functional prototype of my future tehme with gantry5 and helium. All just facade, no functionality behind it yet and no time used to create a pretty design. With such a theme you can not earn money, that’s clear. But it’s fun. Certainly I will not build it with gantry5, but at most with grapesjs, if I make this work great with Grav. It would be great if my theme had built in the theme builder directly, so that everyone can simply develop the theme further. Two photos and two pdf. And you can laugh about it, no problem, because I’m not a software developer, just a beginner user.

full pdf versions

Now I see where all these ideas come from :slight_smile: And sometimes customers just need to hear a loud and clear “NO!”, but the main issue here is this “bridge between the customer and the software manufacturer” - it’s a one way bridge. I’ve been a web developer for 15-20 years now and I never encountered from PMs anything other than “customer is always right”. No, they are not! Lots of customers don’t even know what they need until you show it. So if some client asks you something, you should not try to satisfy them straight away if you know there’s no solution yet, but rather offer alternatives if case is similar to this one.

Sorry, but for me it’s the end of this discussion. I don’t see a point going back and forth. I see your point to satisfy clients, but you should also see a point, that the issues you’re seeking solutions for, are just too small to be solved on a big scale. As I already mentioned, there are plugins that already do what you want. Just take them and adapt, but I don’t believe there will be anyone willing to spend months for something that’s not used on a large scale.

1 Like

Your attitude is typical for software developers. Many software developers think that it is about realizing their own ideas instead of providing the customer with the product they need. There are even software developers who think that they know the customer’s needs better than the customer himself. A somewhat intraverted point of view, I think.

But fortunately, the people at Grav, who have the helm in their hands, are carved out of other wood. I hope that Grav will have a great way ahead in the future and can contribute a lot to preparing the CMS development for the next phase!

Well… Your attitude is typical for PM :slight_smile: :man_shrugging: Even now you try to squeeze the last drop of blood from OS devs. Even alternatives were pointed out, but you still try to push devs (which aren’t even hired or commited in any way) to get what your client needs. And what does @OleVik CV has to do with this topic?

Anyway, I think your main question has been already answered :thinking: If it doesn’t fit you and you still want an all-in-one CMS, you could always gather a team, do some analytic job, create proper specs, hire devs and then evaluate if it was worth to satisfy a handful of clients :money_with_wings:

Oh, the solution has been around since 2009, when I started my private website, without CMS. The website contains both the method of grid navigation, i.e. 2 dimensional menus, even multilayer grid-nav. In the upper area of the website, at the 3 large bricks, you can test it. Patchwork is also already available, i.e. the use of various basic functions on a website without really integrating the functions. You can see this in the small bricks, which lead to external tools. There are also some bricks that lead to internal pages, which can also be reached in the upper part, but on a deeper grid-nav level. Unfortunately, there are no integrated navigation buttons on portalpb, which is why you have to use the back button of the browser, or simply close the additionally opened tab to go back one level higher. Document outsourcing has also been implemented for some time, with two file hosts.

With Grav and my future theme grid-nav-doc I plan to rebuild portalpb technically so that I no longer have to be ashamed of the bad html code and the css file, which contains only 5 settings :joy:

Portal PB

And since I have a WP website since 2021, with beginner instructions on how to install a small Linux on an old computer (really for beginners) and there were problems with the free hoster, I also want to rebuild this website with Grav and grid-nav-doc.


Both websites should ultimately be operated as a static website, I do the development locally on my old notebook. So I try to integrate the simple functions into the theme, so that the plugin from OleVik (static generator) has the best chances to work correctly and also so that I can perhaps also develop grid-nav-doc for other website builders without starting from scratch. Whether it works, I do not know yet.

What does OleVic have to do with this items? Well he is the man with the open mind at Grav, which can be clearly seen on his website. Such people impress me, they are broadly interested and engaged, good bridge builders and apparently also with a religious background. God is love, we believe, and love is what unites us humans. In contrast to fear, which quickly leads to hatred and aversion and conflicts.

have a good night, Karmalakas

Did you really just throw a religion argument into a strangers face? :joy: That tells so much more about your attitude than all this discussion :slight_smile: Now I’m really out of here

Ok, see you then later, maybe!

I’ve no idea how my CV relates to anything, but I certainly am not “the man with the open mind at Grav”. I guess I have a religious background now, maybe I’ll start a church.