- This topic has 41 replies, 4 voices, and was last updated 1 year, 4 months ago by Gerik.
-
AuthorPosts
-
May 25, 2020 at 9:24 am #1300826Gerik
Hello!
I’m building a real estate website using ihomefinder’s Optima Express. It has some pages that require full width (built through their system, not a page under Pages in WordPress) and some that need a container with no sidebar.
How do I make Templates? I tried using Elements but it requires me to pick a page/post which (Optima Express’ pages) are not on the list.
May 25, 2020 at 9:45 am #1300857GerikI’m assuming I have to do it this way?
https://generatepress.com/forums/topic/how-to-create-page-templates-for-childrens-theme/
I found this after I posted it. Some of the links are broken but I can still find them on WordPress. Is there an alternative method?
May 25, 2020 at 3:38 pm #1301235TomLead DeveloperLead DeveloperHi there,
Yes – this should help: https://developer.wordpress.org/themes/template-files-section/page-template-files/#creating-custom-page-templates-for-global-use
May 26, 2020 at 9:34 am #1302364GerikOkay I know what needs to be done but I don’t know how to code.
I can copy the GeneratePress codes but that will not give me the size I need…
Do you recommend someone that can do it (not for free)?
1. Full-Width Template
2. Content Only max-width 1280px
3. Content plus Widget (75/25) max-width 1280pxMay 26, 2020 at 3:54 pm #1302725TomLead DeveloperLead DeveloperIf you want to set up those templates and then link me to a page using each of them, I can provide the CSS 🙂
May 26, 2020 at 5:28 pm #1302782Gerik.com/full-width/
.com/content-only/
.com/content-plus-widget/I uploaded the page PHP files with a different name. Created the pages and adjusted them to what I need through the page editor. Is that right?
May 27, 2020 at 9:12 am #1303777TomLead DeveloperLead DeveloperPerfect.
So it looks like you have the full width template done.
Now for the other two – when you say content only, do you mean no header, no footer and no navigation?
May 27, 2020 at 12:00 pm #1303968GerikI think I didn’t follow your directions well.
I made the pages and edit it inside of WordPress which is useless to me because the file itself is not edited only that page.
I reverted everything to default. You may now look.
Full is edge to edge
Content only is 1280px width
Content with Right sidebar total with 1280pxMay 27, 2020 at 4:44 pm #1304226TomLead DeveloperLead DeveloperOk, so now I would do this:
Create three new Layout Elements: https://docs.generatepress.com/article/layout-element-overview/
For the first one, set the container to full width, and disable the sidebar.
For the second one, use Disable Elements to disable everything on the page except for the content.
For the third one, use Disable Elements to disable everything on the page, but keep the sidebar.
Leave the Display Rules empty for all three, but take note of each Element ID (the number in the URL).
Now you can do this:
add_filter( 'generate_layout_element_display', function( $display, $element_id ) { if ( 123 === $element_id && is_page_template( 'pagefull.php' ) ) { $display = true; } if ( 456 === $element_id && is_page_template( 'contentonly.php' ) ) { $display = true; } if ( 789 === $element_id && is_page_template( 'contentsb.php' ) ) { $display = true; } return $display; }, 10, 2 );
Now just update the
$element_id
values with the correct IDs, and those Layout Elements should apply to your custom page templates.May 27, 2020 at 5:01 pm #1304236GerikIt’s been a while since I touched backend wordpress, I know I had a plugin that I can add these codes under plugins but I can’t remember what it was called. OR do I add that code somewhere else?
May 27, 2020 at 5:05 pm #1304238GerikFound it. Editing Functions.php in the theme folder.
May 27, 2020 at 5:16 pm #1304249Gerikit didn’t work.
This is the page with the “full-width” template that I need to work: .com/homes-for-sale-search/
This is the page I create in WP (your instructions) and it works: .com/full-width/
Element ID 8949
May 27, 2020 at 5:41 pm #1304260Gerik
May 28, 2020 at 9:35 am #1305301TomLead DeveloperLead DeveloperThat code should be added using one of these methods: https://docs.generatepress.com/article/adding-php/
homes-for-sale-search
doesn’t seem to be using any custom page template according to its body classes.May 28, 2020 at 9:46 am #1305317GerikI added the code to the functions.php
It does nothing to this page .com/homes-for-sale-search/
I know I did the code correctly because this works .com/full-width/
Element ID 8949
-
AuthorPosts
- You must be logged in to reply to this topic.