Forums

[resolved] Create Template from single.php (2 posts)

  1. cableghost
    Member
    Posted 2 weeks ago #

    I would like to generate a template page from single.php.

    It is obvious that I can't just save it as a template, so what do I change in my new template (see below) to show a specific post?

    <?php get_header(); ?>
    
    <!--
    single.php
    ~~~~~~~~~~~~~~~~~~~~~~~~ ~~~ -->
    
    <!--
    Content of the page (inc comments and post details)
    ~~~~~~~~~~~~~~~~~~~~~~~~ ~~~ -->
    
    <div id="page-body-wrapper">	
    
    	<div id="content">
    
    	<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    	<?php $ids[0] = get_the_ID(); // grabs the id of the page so it can be excluded in the recent posts plus widget ?>  
    
    <!--
    The Post
    ~~~~~~~~~~~~~~~~~~~~~~~~ ~~~ -->
    
    		<div class="post-content">
    
    <!--
    Widget Area: [All Content] Above
    ~~~ -->
    			<?php dynamic_sidebar('[All Content] Above'); ?>
    
    <!--
    The Post Title
    ~~~ -->
    			<h1 class="h1-underline"><?php the_title(); ?></h1>
    <!--
    Widget Area: [Content Item] Above
    ~~~ -->
    			<?php dynamic_sidebar('[Content Item] Above'); ?>
    <!--
    Widget Area: [Content Item] Left
    ~~~ -->
    			<?php   dynamic_sidebar('[Content Item] Left'); ?>
    <!--
    Widget Area: [Content Item] Right
    ~~~ -->
    			<?php	dynamic_sidebar('[Content Item] Right'); ?>
    <!--
    The content itself
    ~~~ -->
    			<?php   the_content(''); ?>
    
    <!--
    Pagination for Multi-page posts
    ~~~ -->
    			<?php wp_link_pages('before=<p class="multi-page">Pages:&after=</p>'); // if this is a multipage post then show the navigation ?>
    
    <!--
    Widget Area: [Content Item] Below
    ~~~ -->
    			<?php   dynamic_sidebar('[Content Item] Below'); ?>
    
    		</div> <!-- class="post-content" -->
    
    		<div class="clearFloat"></div>
    
    <!--
    Post Details
    ~~~ -->
    <!-- class="post-details" -->
    
    		<!--
    		<?php trackback_rdf(); ?>
    		-->
    
    		<?php endwhile; else: ?>
    
    			<p>
    			<	h2 class="h2-simulate-h1-size">No posts found</h2>';
    			</p>
    
    		<?php endif; ?>
    
    	...
  2. milindsavale
    Member
    Posted 1 day ago #

    hello friend, i am new comer in wordpress word i ma just starting study of developing template now i am very confuse about what is mean by archive template (archive.php) or single page template( creare using single.php ) also how they are different from index.php template
    As per my reading knowledge they are put together into some folder (our theme folder) which file when loaded if i have choose page or achrive or main template.

    PLS help me

Reply

You must log in to post.

About this Topic