• Hi, I can’t find the way to create a custom page template.In page.php there’s no header call for example, and I can’t understand how to do it. any suggestion?

Viewing 8 replies - 1 through 8 (of 8 total)
  • To create a page template have a look on the blog post.
    Create Page Template
    Hope it will help you more. Thanks

    Thread Starter resunoiz

    (@resunoiz)

    not working on stargazer, that’s why I’m asking. creating a new page.php messes everything

    page.php file is already on the theme, so create a new file named template-page.php.

    Thread Starter resunoiz

    (@resunoiz)

    and in it can I include a custom header directly, different contents?

    As a “brand new” page?

    Page templates are generally created to assign different layout to different pages. Example: we all know contact page has different layout compared to other pages. As it contains map, contact form etc. So creating a different page template for it would be really a good approach. After that, go to backend & create a page called contact & assign it template called ‘Contact’ [created earlier].

    You can visit this link to understand more on page template:https://developer.wordpress.org/themes/template-files-section/page-template-files/page-templates/

    For other pages, page.php handles them.

    Thanks!

    Thread Starter resunoiz

    (@resunoiz)

    still getting page mess.

    this specific theme doesn’t have a “standard” page template, copying-pasting it to create a new template makes the site blank.

    Can you explain what sort page template you want to create? Can you explain your purpose for this so that we can help you.

    Thread Starter resunoiz

    (@resunoiz)

    thank from your patience and support.

    generally when I create a custom page template in other themes I copy page.php in a new file, I rename it as a template page and declaring <?php /* Template Name: Example Template */ ?> and make all my modification inside: calling custom header, giving divs different classes etc.

    page.php in stargazer doesn’t call header for example but a specific post header, called entry-header and I cant edit the “master” header, for example.

    has this structure:

    <?php if ( is_page() ) : // If viewing a single page. ?>
    
    		<header class="entry-header">
    			<h1 <?php hybrid_attr( 'entry-title' ); ?>><?php single_post_title(); ?></h1>
    		</header><!-- .entry-header -->
    
    		<div <?php hybrid_attr( 'entry-content' ); ?>>
    			<?php the_content(); ?>
    			<?php wp_link_pages(); ?>
    		</div><!-- .entry-content -->
    
    		<footer class="entry-footer">
    			<?php edit_post_link(); ?>
    		</footer><!-- .entry-footer -->
    
    	<?php else : // If not viewing a single page. ?>
    
    		<?php get_the_image( array( 'size' => 'stargazer-full' ) ); ?>
    
    		<header class="entry-header">
    			<?php the_title( '<h2 ' . hybrid_get_attr( 'entry-title' ) . '><a href="' . get_permalink() . '" rel="bookmark" itemprop="url">', '</a></h2>' ); ?>
    		</header><!-- .entry-header -->
    
    		<div <?php hybrid_attr( 'entry-summary' ); ?>>
    			<?php the_excerpt(); ?>
    		</div><!-- .entry-summary -->
    
    	<?php endif; // End single page check. ?>
    
    </article><!-- .entry -->

    So I’m not able to manage it.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Custom page template?’ is closed to new replies.