• Hi All!

    I had to create a “blank page” from a theme of an old designer because they never had one already done. I needed a blank one, just with the header and footer, etc so I could add in a testimonials section.

    That being said, I am having issues with seeing any actual text or content I’ve added. It shows white/blank. I added a shortcode on the wp-admin side. Page in question is: https://divinesilhouette.com/testimonials/

    This is the blank page template code. What am I missing? I’ve never created a blank page before, so Im happy I got the header and footer, etc working just fine. Thanks for your assistance!

    <?php /* Template Name: Blank Page Template */ ?>
    
    <?php get_header('subpage'); ?>
    
        <!-- SUBPAGE HEADER -->
          <div class="about-sub-hero">
            <div class="container">
              <div class="sub-hero-text col-lg-6 col-lg-offset-3 col-md-6 col-md-offset-3 col-sm-6 col-sm-offset-3 col-xs-12">
                <h2><?php echo(types_render_field("hero-header", array())); ?></h2>
              </div> <!-- end sub-hero-text -->
            </div> <!-- end container -->
          </div> <!-- end sub-hero -->
    
        <!-- END SUBPAGE HEADER -->
    
    <!-- NAVIGATION -->
    
          <nav class="navbar navbar-top navbar-inverse" role="navigation">
            <div class="container">
              <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                  <span class="sr-only">Toggle navigation</span>
                  <span class="icon-bar"></span>
                  <span class="icon-bar"></span>
                  <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="<?php echo home_url(); ?>"><img src="<?php bloginfo('template_directory'); ?>/images/logo-nav.png" alt=""></a>
              </div>
    
          <?php wp_nav_menu( array( 'theme_location' => 'main-nav', 'container_class' => 'collapse navbar-collapse navbar-ex1-collapse nav-pulls', 'menu_class' =>  'nav navbar-nav' ) ); ?>
    
            </div><!-- /.container -->
          </nav>
    
         <!-- END NAVIGATION --> 
    
    <div id="main-content" class="main-content">
    
        <div id="primary" class="content-area">
            <div id="content" class="site-content" role="main">
                <?php
                    // Start the Loop.
                    while ( have_posts() ) : the_post();
    
                        // Include the page content template.
                        get_template_part( 'content', 'page' );
    
                    endwhile;
                ?>
            </div><!-- #content -->
        </div><!-- #primary -->
    </div><!-- #main-content -->
    
    <?php get_footer(); ?>
Viewing 10 replies - 1 through 10 (of 10 total)
  • Hi

    I think you’re missing an if statement.

    <?php /* Template Name: Blank Page Template */ ?>
    
    <?php get_header('subpage'); ?>
    
        <!-- SUBPAGE HEADER -->
          <div class="about-sub-hero">
            <div class="container">
              <div class="sub-hero-text col-lg-6 col-lg-offset-3 col-md-6 col-md-offset-3 col-sm-6 col-sm-offset-3 col-xs-12">
                <h2><?php echo(types_render_field("hero-header", array())); ?></h2>
              </div> <!-- end sub-hero-text -->
            </div> <!-- end container -->
          </div> <!-- end sub-hero -->
    
        <!-- END SUBPAGE HEADER -->
    
    <!-- NAVIGATION -->
    
          <nav class="navbar navbar-top navbar-inverse" role="navigation">
            <div class="container">
              <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                  <span class="sr-only">Toggle navigation</span>
                  <span class="icon-bar"></span>
                  <span class="icon-bar"></span>
                  <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="<?php echo home_url(); ?>"><img src="<?php bloginfo('template_directory'); ?>/images/logo-nav.png" alt=""></a>
              </div>
    
          <?php wp_nav_menu( array( 'theme_location' => 'main-nav', 'container_class' => 'collapse navbar-collapse navbar-ex1-collapse nav-pulls', 'menu_class' =>  'nav navbar-nav' ) ); ?>
    
            </div><!-- /.container -->
          </nav>
    
         <!-- END NAVIGATION --> 
    
    <div id="main-content" class="main-content">
    
        <div id="primary" class="content-area">
            <div id="content" class="site-content" role="main">
    <?php
                    // Start the Loop.
                     if ( have_posts() ) : while ( have_posts() ) : the_post();
    
                        // Include the page content template.
                        get_template_part( 'content', 'page' );
    
                    endwhile;endif;
                ?>
            </div><!-- #content -->
        </div><!-- #primary -->
    </div><!-- #main-content -->
    
    <?php get_footer(); ?>

    All the best!

    Thread Starter bguerrero

    (@bguerrero)

    It’s still not showing up – what am I missing? I’ve never needed to create a blank page so to say, as usually the themes I get have some sort of basic page to add in whatever I want.

    I copied that exact code to the blankpagetemplate.php file. It shows its updated, the shortcode is in the backend of the wp-admin section as [bne_testimonials_list] (pasted into the visual or text box like I’ve done for numerous themes before) and still nothing. Any suggestions to work around this?

    Thank you for all your help!

    does your theme have a file content-page.php,
    as you are trying to call from: get_template_part( 'content', 'page' ); ?

    alternative, for testing, replace that line with the_content();

    Hi

    I agree with @michael

    Thread Starter bguerrero

    (@bguerrero)

    YES! I can see the testimonials now! I dont have a content-page.php that’s why, I don’t know why that was in there either. Thank you!

    Now the style/fonts doesn’t seem to be on there, as if you look at https://divinesilhouette.com/testimonials/
    you can see how the words are all pushed over to the right, all different fonts, etc.

    Am I missing a line in there for the style? I dont seem to have a template page to reference to, because the original designer of the site never made one. Only header template, footer template, menu/nav template.

    Thank you again!
    Brandi

    Add css and format your page template. There is no missing line, you just need to add styles that render your testimonials in the desired format.

    All the best!

    Now the style/fonts doesn’t seem to be on there,

    try to match the html structure of the custom page template to the html structure of page.php or index.php of your theme.

    if you need assistance, could you post the code of page.php of your theme?

    Thread Starter bguerrero

    (@bguerrero)

    Thank you! I appreciate all the help. Here is the index.php code. I don’t see where any of the css is referenced in the actual code, I looked at all the pages. Again, I am new to this whole “building blank pages” but I really appreciate all your guys’ help because I’m learning so much!

    <?php
    /*
    Template Name: Blog Page Template
    */
    ?>
    
    <?php get_header('subpage'); ?>
    <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
    
        <!-- SUBPAGE HEADER -->
          <div class="blog-single-hero new-blog-hero">
            <div class="container">
              <div class="sub-hero-text col-lg-6 col-lg-offset-3 col-md-6 col-md-offset-3 col-sm-6 col-sm-offset-3 col-xs-12">
                <h2><?php echo get_post_meta(97, 'wpcf-hero-text', true); ?></h2>
              </div> <!-- end sub-hero-text -->
            </div> <!-- end container -->
          </div> <!-- end sub-hero -->
    
        <!-- END SUBPAGE HEADER -->
    
        <!-- NAVIGATION -->
    
          <nav class="navbar navbar-top navbar-inverse" role="navigation">
            <div class="container">
              <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                  <span class="sr-only">Toggle navigation</span>
                  <span class="icon-bar"></span>
                  <span class="icon-bar"></span>
                  <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="<?php echo home_url(); ?>"><img src="<?php bloginfo('template_directory'); ?>/images/logo-nav.png" alt=""></a>
              </div>
    
          <?php wp_nav_menu( array( 'theme_location' => 'main-nav', 'container_class' => 'collapse navbar-collapse navbar-ex1-collapse nav-pulls', 'menu_class' =>  'nav navbar-nav' ) ); ?>
    
            </div><!-- /.container -->
          </nav>
    
         <!-- END NAVIGATION --> 
    
        <!-- CONTENT -->
    
        <div class="single-post-wrapper">
          <div class="container">
            <div class="row">
    
              <div class="col-lg-8 col-md-8">
                <?php
                  $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
                  query_posts(array('paged' => $paged, 'posts_per_page' => '3'));
                    if(have_posts()) :
                      while(have_posts()) : the_post();
                ?>
    
                <div class="single-post-content single-post-content-index">
    
                  <div class="post-image">
                    <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('full'); ?></a>
                  </div>
    
                    <div class="post-content-header">
                     <a href="<?php the_permalink(); ?>"><h3><?php the_title(); ?> </h3></a>
                    </div>
    
                    <div class="post-date post-date-index second-social-index-wrapper">
    
                      <div class="hidden-sm hidden-xs">
                        <p> <span class="font-icon-time footercolour-noroll icon-space"> </span> <b><?php echo get_the_date(); ?></b></p>
                        <p> <span class="font-icon-category footercolour-noroll icon-space"> </span> <?php global $post; foreach(get_the_category() as $category) {echo '<a href="'.get_category_link($category->cat_ID).'">'. $category->cat_name.'</a>';} ?></p>
                        <p>
                        <a href="https://twitter.com/intent/tweet?text=<?php echo the_title('','',false); ?>&url=<?php the_permalink(); ?>"><span class="font-icon-twitter footercolour post-date-icon-space"></span></a>
                        <a href="#"
                          onclick="
                            window.open(
                              'https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(location.href), 'facebook-share-dialog', 'width=626,height=436'); return false;"><span class="font-icon-facebook footercolour post-date-icon-space"></span></a>
                            <a href='https://www.pinterest.com/pin/create/extension/?media=<?php echo wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?>?url=<?php the_permalink(); ?>' target='_blank'><span class="font-icon-pinterest footercolour post-date-icon-space"></span></a>    </p>
                      </div> <!-- hidden-sm -->
    
                      <div class="second-social-index visible-sm visible-xs">
                        <p> <span class="font-icon-time footercolour-noroll icon-space"> </span> <b><?php echo get_the_date(); ?></b> &nbsp; &nbsp;<br class="visible-sm visible-xs">
                        <span class="font-icon-category footercolour-noroll icon-space"> </span> <?php global $post; foreach(get_the_category() as $category) {echo '<a href="'.get_category_link($category->cat_ID).'">'. $category->cat_name.'</a>';} ?> &nbsp; &nbsp;
                        <span class="single-share"> Share &nbsp;                    <a href="https://twitter.com/intent/tweet?text=<?php echo the_title('','',false); ?>&url=<?php the_permalink(); ?>"><span class="font-icon-twitter footercolour post-date-icon-space"></span></a>
                        <a href="#"
                          onclick="
                            window.open(
                              'https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(location.href), 'facebook-share-dialog', 'width=626,height=436'); return false;"><span class="font-icon-facebook footercolour post-date-icon-space"></span></a>
                            <a href='https://www.pinterest.com/pin/create/extension/?media=<?php echo wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?>?url=<?php the_permalink(); ?>' target='_blank'><span class="font-icon-pinterest footercolour post-date-icon-space"></span></a>    </p>
                        </span>
                      </div> <!-- second-social-index -->
    
                    </div> <!-- end post-date -->
    
                    <div class="post-text post-text-index">
                      <p><?php the_excerpt(); ?></p>
                    </div> <!-- end post-text -->
    
                  </div> <!-- end single-post-content -->
                 <div class="index-hr"><hr></div>
    
                <?php endwhile; ?>
                <!-- End of the mail loop -->
                <!-- Add the pagination functions here. -->
    
                <nav id="page-nav" class="navigation" role="navigation">
                  <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav"></span> << Previous', 'twentytwelve' ) ); ?></div>
                  <div class="nav-next"><?php previous_posts_link( __( 'Next >> <span class="meta-nav"></span>', 'twentytwelve' ) ); ?></div>
                </nav><!-- page-nav -->
    
                <?php else : ?>
                <br>
                <h3 class="single-post-header"><?php _e('Sorry, no posts matched your criteria.'); ?></h3>
                <?php endif;?> 
    
              </div> <!-- end col-lg-8 -->
    
              <div class="single-post-sidebar white-background col-lg-4 col-md-4">
    
                <div class="blog-search hidden-sm hidden-xs">
                  <form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
                      <div class="row-fluid">
                          <div class="span12">
                              <input type="text" value="Search" onblur="if (this.value == '') {this.value = 'Search';}" onfocus="if (this.value == 'Search') {this.value = '';}" name="s" id="blogSearch" /><span class="font-icon-search footercolour-noroll blog-search-icon"></span>
                              <input type="hidden" name="post_type" value="post" />
                          </div>
                      </div>
                  </form>
                </div> <!-- end blog-search -->
    
                <div class="recent-posts">
                  <h3><span class="font-icon-blog footercolour-noroll icon-space"></span><span class="recent-posts-header">Recent Posts</span></h3>
                  <ul>
                    <?php query_posts('showposts=6'); ?>
                    <?php while (have_posts()) : the_post(); ?>
    
                      <li>
                        <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                      </li>
    
                    <?php endwhile; ?>
                  </ul>
                  <?php wp_reset_query(); ?>
    
                </div> <!-- end recent-posts -->
    
                <div class="category-list">
                  <h3><span class="font-icon-category footercolour-noroll icon-space"></span>  <span class="recent-posts-header">Categories</span></h3>
                  <ul>
                    <?php
                    $args = array(
                      'orderby' => 'name',
                      'parent' => 0,
                      'hide_empty' => 0
                      );
                    $categories = get_categories( $args );
                    foreach ( $categories as $category ) {
                      echo '<li><a href="' . get_category_link( $category->term_id ) . '">' . $category->name . '</a></li>';
                    }
                    ?>
                  </ul>
                </div> <!-- end category-list -->
    
                <div class="blog-search blog-search-second visible-sm visible-xs">
                  <form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
                      <div class="row-fluid">
                          <div class="span12">
                              <input type="text" value="Search Babble" onblur="if (this.value == '') {this.value = 'Search Babble';}" onfocus="if (this.value == 'Search Babble') {this.value = '';}" name="s" id="blogSearch" /><span class="font-icon-search footercolour-noroll blog-search-icon"></span>
                              <input type="hidden" name="post_type" value="post" />
                          </div>
                      </div>
                  </form>
                </div> <!-- end blog-search -->
    
                <div class="archives archives-index">
                    <div class="dropdown">
                        <!-- Link or button to toggle dropdown -->
                        <button type="button" class="archivedrop dropdown-toggle" data-toggle="dropdown">
                           <p>Archives<span><img src="<?php bloginfo('template_directory'); ?>/images/dropshotarrows.png" class="dropshot-arrow pull-right" alt=""></span></p>
                        </button>
                        <ul class="dropdown-menu archivedroplist" role="menu" aria-labelledby="dropdownMenu1">
                          <?php wp_get_archives('type=monthly'); ?>
                        </ul>
                    </div> <!-- end dropdown -->
                </div>
    
                <div class="sidebar-follow">
                  <span class="sidebar-follow-header">Follow Us</span>
                  <a href="https://twitter.com/DivineWellness3"><span class="font-icon-twitter footercolour icon-spacing"></span></a>
                  <a href="https://www.pinterest.com/divinewellness"><span class="font-icon-pinterest footercolour icon-spacing"></span></a>
                  <a href="mailto:[email protected]"><span class="font-icon-mail footercolour icon-spacing"></span></a>
                </div> <!-- end sidebar-follow -->
    
              </div> <!-- end single-post-sidebar -->
    
            </div> <!-- end row -->
          </div> <!-- end container -->
        </div> <!-- end single-post-wrapper -->
    
        <!-- END CONTENT -->
    
    <?php get_footer(); ?>

    your new template is using this before the loop:

    <div id="main-content" class="main-content">
    
        <div id="primary" class="content-area">
            <div id="content" class="site-content" role="main">

    those selectors don’t seem to be styled in the stylesheets of your theme.
    this would explain the missing padding or margins, etc.

    in contrast to that, the index template uses the below before the loop:

    <div class="single-post-wrapper">
          <div class="container">
            <div class="row">
    
              <div class="col-lg-8 col-md-8">
    Thread Starter bguerrero

    (@bguerrero)

    I replaced that and it works BEAUTIFULLY. Thank you so much! I built my first official template page! ??

    Thank you again to all – such great support!

    Brandi

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Blank Page Template created, can't add content’ is closed to new replies.