• Need some help from the code-savvy with this one…

    The theme I am using has two alternate page templates included, one of which is exactly what I want…same page setup, but with full page width available for content and no sidebar.

    However, when I use this template for the page and preview or publish all I see is the empty template…none of the content I have entered is visible.

    I am thinking this is somehow to do with the fact that this template is called “Links” and when I look at the code for it I see the following:

    <?php
    /*
    Template Name: Links
    */
    ?>
    
    <?php get_header(); ?>
    
    <div id="content" class="widecolumn">
    
    <h2>Links:</h2>
    <ul>
    <?php get_links_list(); ?>
    </ul>
    
    </div>
    
    <?php get_footer(); ?>

    Is the line “<?php get_links_list(); ?> the reason why it does not function in the way that I want?

    If so, can I just delete the line, or do I need to add something to make it function as a normal page?

    Apologies for sounding clueless here, but php is not my normal habitat and I am a WP newbie.

Viewing 5 replies - 1 through 5 (of 5 total)
  • By “content” do you mean posts you’ve written? Or text typed when you created the page?

    Thread Starter videoguy9

    (@videoguy9)

    I am writing a new “Page” not post for which I have chosen a parent page and selected the “links” template.

    I have inserted a Page title, body text and banner code, but none of this appears when the page is previewed or published.

    The code I posted is the entire content of the links.php file from the Theme editor.

    Your content isn’t showing because a “Page” is similar to a Post. So you need the LOOP code in your page template file.

    1. Copy the following code and paste into a text editor (ex: Notepad).
    2. Save it as “wide_page.php“.
    3. Upload the file into your current theme’s directory.
    4. In your Dashboard, when you go to edit this Page, you should now see “Wide_Page” as a page template option in the drop-down menu.
    <?php
    /*
    Template Name: Wide_Page
    */
    ?>
    
    <?php get_header(); ?>
    
    <div id="content" class="widecolumn">
    
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<div class="post" id="post-<?php the_ID(); ?>">
    		<h2><?php the_title(); ?></h2>
    			<div class="entry">
    				<?php the_content('<p class="serif">Read the rest of this page &raquo;
    '); ?>
    
    				<?php wp_link_pages(array('before' => '<strong>Pages:</strong> ', 'after' => '
    ', 'next_or_number' => 'number')); ?>
    
    			</div>
    		</div>
    		<?php endwhile; endif; ?>
    	<?php edit_post_link('Edit this entry.', '', '
    '); ?>
    
    </div>
    
    <?php get_footer(); ?>
    Thread Starter videoguy9

    (@videoguy9)

    Thanks so much.

    Really appreciate it…hope someone else makes your day as good as you have made mine.

    Have a wonderful holiday season too…

    No prob. You too!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Template does not show content’ is closed to new replies.