Archived topic
Templating question
2 replies · Started by Mike on August 26, 2019
I have a plugin that has a function.
The function is meant to be put in a template to run code and output html and javascript to the template.
I have done it this way:
1) Copy page.php.orig to search-page.php
2) In search-page.php add: * Template Name: My template
3) Also add: if (function_exists('my_function')) { my_function(); }
4) Create a page and base it on this template
5) View the page
This works fine and as a matter of fact worked perfect on another site that used GP free.
Now I am using GP Premium and the problem is that the output of the function is not contained within the page contents. It does not seem to be in the right div. The output does not have a left margin like the heading of the page. On a narrow screen, the output is right against the left side of the screen, no margin at all.
I noticed that search-page.php contains a template call to content-page, and I am wondering if I should put my function in content-page.php? I believe this is the correct name of the sub-template, pardon me if not correct, I am going by memory, but hopefully you know what I mean...
But then all pages will call content-page.php, not just my template search-page.php.
So I am not sure what to do.
For privacy of the client I prefer not to provide a url at the moment....
Resolved by Customizing > Layout > Container
And setting Content Layout to One container
Glad you got it working :)