WordPress.org

Ready to get started?Download WordPress

Forums

Blog post page with different template (4 posts)

  1. kansas3d
    Member
    Posted 1 year ago #

    Hi everyone,

    I'm looking to get this problem solved for hours now but can't find a proper solution for it.

    My Front Page is a static page with an own php template file. This works fine already.

    Now I want to create a blog page that has a different template from that and the other sites.
    How can I get a different php file as a template for my blog post site?
    When I chose under Page my new template for the Blog page it just takes the template that every site has. But I want to have a different template just for the Blog page.

    Thanks

  2. Rajavenkateshwaran
    Member
    Posted 1 year ago #

    Hello kansas3d,
    when you click Appearance->editor

    Basically you will be having theme files like
    index.php
    functions.php
    page.php
    post.php
    contact-page.php
    full width template.php
    blog-template.php
    style.css

    if your theme supports blog template you need to tweak the code of the file i highlighted. It may not be with the exact name but it might be related to the name blog.

    Make sure you back up the file.
    Let me know if you have more questions

  3. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    you might need to create your own custom page template;
    http://codex.wordpress.org/Page_Templates#Custom_Page_Template

    example:
    http://codex.wordpress.org/Page_Templates#A_Page_of_Posts

    you will need to adapt that to match your theme's html structure.

  4. kansas3d
    Member
    Posted 1 year ago #

    Thank you Rajavenkateshwaran and alchymyth for your responses.

    I'm using Buddypress as Childtheme.
    I tried to put blogs-loop.php in my child folder but nothing happens.

    If I select the own created php-File and add is as template in the Page it's working and using it noW :)

    But Only when I'm leaving Settings > Reading empty under static page > Post page.

    But how do I get the an overview of all posts on this site now?

    The code I'm currently having in doen't show anything:

    <?php if ( have_posts() ) : ?>
    
    			<?php /* Start the Loop */ ?>
    			<?php while ( have_posts() ) : the_post(); ?>
    				<?php get_template_part( 'content', get_post_format() ); ?>
    			<?php endwhile; ?>
    
    			<?php twentytwelve_content_nav( 'nav-below' ); ?>
    
    		<?php else : ?>
    
    			<article id="post-0" class="post no-results not-found">
    
    			<?php if ( current_user_can( 'edit_posts' ) ) :
    				// Show a different message to a logged-in user who can add posts.
    			?>
    				<header class="entry-header">
    					<h1 class="entry-title"><?php _e( 'No posts to display', 'twentytwelve' ); ?></h1>
    				</header>
    
    				<div class="entry-content">
    					<p><?php printf( __( 'Ready to publish your first post? <a href="%s">Get started here</a>.', 'twentytwelve' ), admin_url( 'post-new.php' ) ); ?></p>
    				</div><!-- .entry-content -->
    
    			<?php else :
    				// Show the default message to everyone else.
    			?>
    				<header class="entry-header">
    					<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentytwelve' ); ?></h1>
    				</header>
    
    				<div class="entry-content">
    					<p><?php _e( 'Apologies, but no results were found. Perhaps searching will help find a related post.', 'twentytwelve' ); ?></p>
    					<?php get_search_form(); ?>
    				</div><!-- .entry-content -->
    			<?php endif; // end current_user_can() check ?>
    
    			</article><!-- #post-0 -->
    
    		<?php endif; // end have_posts() check ?>

    Thanks a lot

Topic Closed

This topic has been closed to new replies.

About this Topic