WordPress Get Template part

Going trough a WordPress template i found the get template

<?php 
            if ( is_home() ) {
                get_template_part('home', 'featured'); 
                get_template_part('home', 'recent');
            }
        ?>

which calls certain template parts when the home page is displayed.

Read More

Is there a way to use the same function for certain pages? For example for domain-name.com/contact ?

Thanks

Related posts

Leave a Reply

1 comment

  1. You can use is_page to determine the page. For example:

    if ( is_page('contact') ) {
        get_template_part('home', 'featured'); 
        get_template_part('home', 'recent');
    }
    

    The parameter to the function can be the Page ID, Page Title or Page Slug.