How to modify a theme without change core files? [OJS 2.4.8-1]


I need to know how to create for instance a custom journal.tpl without change the core files.

I’m using the vanila theme and i created the core folder structure inside: vanila/templates/index/journal.tpl and nothing changes when i edit this file.

What am i supposed to change/edit?


1 Like


That is not default functionality in OJS2. I had this in my old OJS2 theme plugin that enabled me to change the template. I have seen other similar solutions and you could probably find them with a search.

	function getStylesheetFilename() {
		return 'myTheme.css';
	function activate(&$templateMgr) {

		$theme_template_id = "myTheme";
		$theme_template_dir = Core::getBaseDir() . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $theme_template_id . DIRECTORY_SEPARATOR . 'templates';
		$app_template_dir = Core::getBaseDir() . DIRECTORY_SEPARATOR . 'templates';
		$core_template_dir = Core::getBaseDir() . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'pkp' . DIRECTORY_SEPARATOR . 'templates';	
		$templateMgr->template_dir = array($theme_template_dir, $app_template_dir, $core_template_dir);											      
		$templateMgr->compile_id = $theme_template_id;
		if (($stylesheetFilename = $this->getStylesheetFilename()) != null) {
			$path = Request::getBaseUrl() . '/' . $this->getPluginPath() . '/' . $stylesheetFilename;
1 Like


It works! I was looking for this since forever!

Marry me and raise my children!!!

Thanks again!

1 Like

You are wellcome. I will let you know if something happens with my current marriage.

1 Like

I’m just trying to have the samething with footer.tpl, but nothing changes at all.

i just recreate the lib/pkp/templates/common/footer.tpl inside my template folder and nothing happens.

Do u know how to get this done?


In my old OJS2 theme I had that in templates/common/footer.tpl
Also after changing it, you maybe have to clear ojs file cache.

Edit: I uploaded my old OJS2 theme here: GitHub - ajnyga/tsvResponsive: Simple responsive OJS2.x theme
That was created before we decided to go with OJS3. That theme is actually not using custom templates at all, because in the end I accomplished all the required changes with CSS. The theme is responsive and it hides the left sidebar and turns the right sidebar into a footer.

1 Like

Worked like a charm. I was thinking that i have to mimic the lib/pkp structure like i saw in this post:

I messed with the and nothing happened.

Thks again.

Hi @ajnyga

I am trying put this code in my theme. I put in OJS that install in localhost, it works very good.
However, when i put in my OJS that already installed online on the server, this doesn’t work.
What do you think the problem?

Hard to say, are you seeing error in php error log? And what do you mean exactly when you say that it does not work? Do you mean that you have uploaded an edited template, but the changes are not visible? Maybe you need to clear the ojs cache first?

yes, i changed the template and not visible. I don’t know abut php error log. The site still show the original template. I cleared the cache in my browser, because i did not find any link in ojs 2 to clear the cache. In Ojs 3 it easy to found the link to clear the ojs cache.

I usually emtpy the template cache with rm cache/t_compile/*.php

What template did you modify and when you added the template to the plugin folder, did you use the same folder structure as in the template folder?

I mean if you for example modify this template: ojs/navbar.tpl at ojs-stable-2_4_8 · pkp/ojs · GitHub
You need to have it in folder like plugins/themes/yourtheme/templates/common/navbar.tpl