Site logo

Archived topic

How to add Theme Templates

41 replies · Started by Gerik on May 25, 2020

Viewing posts 16–30 of 42

Sounds good - thanks!

I have to close this to open other topics.

I'm stuck. Support got back to me and asked if I can test it with the Twenty-fifteen WP theme. The navigation is on the left-hand side so full with and no sidebar is out of the question.

I did try it with Divi Theme which is one of the recommendations. Divi has a template page called blank which has no header, footer, or sidebar. Didn't work.

There is another theme called HomePress. It has page templates and they work. This is their page template.

<?php

/*
 Template Name: IDX-iHomefinder
 */

$page_style_idxBroker = homepress_get_option('page_style_ihomefinder');

if ($page_style_idxBroker == 'full_width') {
    $content_area = 'col-lg-12 col-md-12 col-sm-12 col-xs-12';
} else if ($page_style_idxBroker == 'right_sidebar') {
    $content_area = 'col-lg-9 col-md-12 col-sm-12 col-sm single-post__content order-0';
} else {
    $content_area = 'col-lg-9 col-md-12 col-sm-12 col-sm single-post__content order-1';
}

?>

<?php get_header(); ?>
<?php get_template_part('template-parts/page', 'title'); ?>

<section class="container">

    <div class="row">
        <div class="<?php echo esc_attr($content_area); ?>">
            <?php
                while (have_posts()) : the_post();
                    the_content();
                endwhile;
            ?>
        </div>

        <?php if ($page_style_idxBroker !== 'full_width') { ?>
            <div class="col-lg-3 col-md-12 col-sm-12 sidebar-box page__sidebar">
                <aside id="sidebar" class="sidebar-white">
                    <?php
                    if (is_active_sidebar('iHomefinder sidebar')) {
                        dynamic_sidebar('iHomefinder sidebar');
                    }
                    ?>
                </aside>
            </div>
        <?php } ?>

    </div>

</section>

<?php get_footer(); ?>

You can see their template is "static"

The funny thing is the body class is still the same "page-template-default page page-id-0 page-parent logged-in admin-bar homepress_layout_homepress customize-support ng-tns-0-0"

do you recommend anyone to look into the Optima Express Plugin? I have trust issues and I've been dealing with GP for a while now, I trust you guys.

I disabled all plugins when doing the test above if you're curious.

They must be doing something weird to overwrite the body class.

You can always copy the page.php file from the parent theme and add it to your child theme. Then add the Template headers and change the filename to something like page-custom-template.php.

Then you can add their specific code into the template like you've done with the templates above.

I decided to put this on hold because I will need to create a page file with all the CSS in it to make it work.

I started working on other things and the strangest thing happened.

I wanted to create an element for other pages on the website.

I created the element and for the showing part, I picked a specific page.

When I went to the website and notice the styling I did for that specific page was done to all the generated page by that plugin.

How do I explain to the plugin programmers who are not familiar with elements and not get an answer like, you should use another theme?

Hi there,

I'm not sure I understand fully. Any chance you can explain further?

Yes,

If I create an Element and assign it to a specific page... This one I assigned to the about page.

it will alter the IDX pages too.

So that Element is set to be active on the "About" page.

Are you saying it's also active on the IDX pages? If so, that would be very peculiar, as the Display Rules should only target the entries you've specified.

I'm back at this.

Is there someone I can hire to look at this?

This is what I've done so far on trial number two.

1. GeneratePress is using the Wired Layout.
2. Created a child theme
3. Added a file (page.php clone) and named it fullwidth.php
4. Created a page called "Full Width" and added the template Full-Width
5. Created a GP Element "Full-Width for IHF" Layout, Content (nosidebars), & Full Width (no padding)
6. Added to function.php

add_filter( 'generate_layout_element_display', function( $display, $element_id ) {
    if ( 4081 === $element_id && is_page_template( 'fullwidth.php' ) ) {
        $display = true;
    }

    return $display;
}, 10, 2 );

Hi there,

Your process looks good if you're targeting pages using that template.

Just to confirm, are your IDX pages using that template and the Layout Element isn't applying?

Can you confirm that the IDX pages are indeed using the template? If you add some static content into the .php file, does it display on the IDX pages?

I added the text "hello this is files fullwidth.php"

The WordPress Page with the Template applied. It is indeed full width
[url=https://ibb.co/x3YZJhN][img]https://i.ibb.co/x3YZJhN/Screenshot-2021-10-11-105309.jpg[/img][/url]
The setting on where the template is applied to the IDX page.
[url=https://ibb.co/BjGMCkN][img]https://i.ibb.co/BjGMCkN/Screenshot-2021-10-11-105404.jpg[/img][/url]
The IDX page. It is NOT full width
[url=https://ibb.co/CBY4pVh][img]https://i.ibb.co/CBY4pVh/Screenshot-2021-10-11-105434.jpg[/img][/url]

Q: IDX pages using that template and the Layout Element isn’t applying?
A: Correct, GP Element is not being applied.

This archived topic is closed to new replies.