Hi,
I upgraded my theme and forgot I made custom changes to my code. I got my old theme to display all posts like this:
http://webcache.googleusercontent.com/search?q=cache:z1HICHC1J-wJ:https://teslacentral.com/+&cd=1&hl=en&ct=clnk&gl=us
But how did I do that? lol. I completely forget what code I need to add to my main page to get it to show that. Any help would be great.
Thank you!
Hi Timothy,
To display all articles on homepage. Please open the index.php file then find the line 18 to line 31
Replace the following code:
<?php if( is_active_sidebar( 'dw_focus_home' ) ) { ?>
<?php dynamic_sidebar('dw_focus_home'); ?>
<?php } else { ?>
<div>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'archive' ); ?>
<?php endwhile; ?>
</div>
<?php dw_focus_pagenavi(); ?>
With new code:
<?php if( is_active_sidebar( 'dw_focus_home' ) ) { ?>
<?php dynamic_sidebar('dw_focus_home'); ?>
<div>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'archive' ); ?>
<?php endwhile; ?>
</div>
<?php dw_focus_pagenavi(); ?>
<?php } else { ?>
See the Screenshot:
Hope this helps!
Hello,
Your code and screenshots are conflicting, as they aren’t the same. I replaced the code you mentioned, and it breaks the entire site as it doesn’t load the homepage.
Can you post the whole index.php with the included change for me?
Hi Timothy,
You can find the code index.php file here:
<?php
/**
* The main template file.
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package DW Focus
* @since DW Focus 1.0
*/
get_header(); ?>
<div id="primary">
<?php if ( have_posts() ) : ?>
<?php dynamic_sidebar('dw_focus_home'); ?>
<div>
<div>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'archive' ); ?>
<?php endwhile; ?>
</div>
<?php dw_focus_pagenavi(); ?>
</div>
<?php else : ?>
<?php get_template_part( 'no-results', 'archive' ); ?>
<?php endif; ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Also, Please log in to Dashboard > Widgets > Home Content then remove the widgets in the Home Content section.
See the screenshot:
Hope this helps !
Hi, that didn’t work, please see; https://teslacentral.com/
Hi, that didn’t work, please see; https://teslacentral.com/
Please add the following code to the index.php file
<?php
/**
* The main template file.
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package DW Focus
* @since DW Focus 1.0
*/
get_header(); ?>
<div id="primary" class="site-content span9">
<?php if ( have_posts() ) : ?>
<?php dynamic_sidebar('dw_focus_home'); ?>
<div class="archive">
<div class="content-inner">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'archive' ); ?>
<?php endwhile; ?>
</div>
<?php dw_focus_pagenavi(); ?>
</div>
<?php else : ?>
<?php get_template_part( 'no-results', 'archive' ); ?>
<?php endif; ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Hope this help !
Yay that worked thank you!
Please login or Register to submit your answer
replied 11 years ago
Hi, that didn’t work. Please see my site
https://teslacentral.com/