Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to edit plugin to use the theme's template files

I am using a theme called Hemingway, it's a great theme with three page layouts. (full-width, with sidebar, without sidebar). This is all working great. I can choose one of three options in page settings.

Page layout template

I'm also using the Projects plugin by Woothemes. This plugin makes it easy to add recent projects with a photo gallery and some other options. It's working when I'm using the shortcode:

[projects limit="12" columns="2" orderby="date" order="desc" exclude_categories=""]

I'm using this shortcode with two columns on a full-width template. This is working great, but when I'm trying to use the functionality to automatically add the content of projects to the page using the option built-in Projects: projects settings The full-width template is not working and the sidebar is shown. Also the two column layout for projects is not working. They just aligned beneath eachother.


How it should look like (this example is with shortcodes):

http://hoveniersbedrijfameland.nl/projecten/

How it looks with the option in projects to choose a page: (this is wrong)

http://hoveniersbedrijfameland.nl/projects/


How can I debug this to see what breaks it?

What I tried so far:

  1. I've tried the plugin to behave like I want. This means, that the plugin will use the full page template for 'categories' instead of using the archive page. I don't really know how the plugin is build, so it's hard to eit the right file.
  2. I've tried a workaround with url routing, but this isn't the best approach.
like image 406
Kees Sonnema Avatar asked Dec 10 '15 07:12

Kees Sonnema


People also ask

How do I edit a WordPress plugin template?

-> Go to wp-content/themes/your-choosen-theme/ and create a folder import-eventbrite and inside this folder create folder layouts. -> Paste the copied file here and edit to your requirements. This file will override the plugin's file.

How do I add a template to my plugin?

With the following code the plugin first look for the called template file in themes/your-theme/woocommerce-plugin-templates/{template-name} , if that isn't found it will search in your main theme file themes/your-theme/{template-name} and falls back to the original plugin templates in plugins/woocommerce-plugin- ...

How do I edit a plugin file?

Plugin editor has a text area where it opens the plugin files. On the right hand side, it lists all the files from the selected plugin. There is a drop down menu on the top that allows you to select a plugin that you want to edit.

How do I override WooCommerce template files plugin?

To do that just copy the WooCommerce template you need to customize and add it to your plugin folder. Now all the customizations you need to make to the WooCommerce cart page can be made in the 'cart. php' file in your plugin folder.


1 Answers

I found a solution. I copied the archive-project.php file to my theme and edited the content with the ones in the full-width template. I need to style it myself because the pages are broken if I leave it like that.

If I want to edit page template now, I need to code it in the ffile instead of choosing it from the pages > page layout in the admin panel. I'll fix that later.

FINAL UPDATE: I hardcoded everything and it's working for me now. I don't need any further help, I'm now looking into the custom post types to change the content template.

like image 108
Kees Sonnema Avatar answered Oct 27 '22 00:10

Kees Sonnema