Skip to content

Commit

Permalink
Fixed broken posts listing on the home page when WP Admin > Settings …
Browse files Browse the repository at this point in the history
…> Front Page isn't set.
  • Loading branch information
lumberman committed Jun 18, 2019
1 parent 8eb6f55 commit fea5fd3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
6 changes: 2 additions & 4 deletions includes/archive-templates.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<?php

/**
* Table of Contents
*
* dslc_archive_template_redirect ( Load custom template )
* dslc_archive_template_init ( Register options )
* dslc_archive_template_404_fix ( Fixes 404 on pagination caused when regular WP query has no more post )
*/


// Prevent direct access to the file.
if ( ! defined( 'ABSPATH' ) ) {
header( 'HTTP/1.0 403 Forbidden' );
Expand All @@ -23,7 +20,6 @@
* @since 1.0
*/
function dslc_template_redirects( $template ) {

global $post;

$template_custom = '';
Expand Down Expand Up @@ -53,6 +49,8 @@ function dslc_template_redirects( $template ) {

} elseif ( is_search() && ! $post ) {
$template_custom = dslc_page_not_found_template_redirect( $template );
} elseif ( is_front_page() && ! get_option( 'page_on_front' ) ) {
$template_custom = dslc_archive_template_redirect( $template );
}

// Return custom or default template.
Expand Down
2 changes: 1 addition & 1 deletion includes/css-generation.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function dslc_custom_css() {
}

// If archive, load template?
if ( is_archive() && $post && ! is_author() && ! is_search() ) {
if ( is_archive() && $post && ! is_author() && ! is_search() || is_front_page() && ! get_option( 'page_on_front' ) ) {
$post_type = get_post_type();

$template_id = dslc_get_archive_template_by_pt( $post_type );
Expand Down
6 changes: 3 additions & 3 deletions includes/display-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ function dslc_filter_content( $content ) {
$cache = new DSLC_Cache( 'html' );
$cache_id = $curr_id;

if ( is_archive() ) {
if ( is_archive() || is_front_page() && ! get_option( 'page_on_front' ) ) {
$post_type_slug = get_post_type();
$template_id = dslc_get_archive_template_by_pt( $post_type_slug );
$cache_id = $template_id;
Expand Down Expand Up @@ -593,7 +593,7 @@ function dslc_filter_content( $content ) {
// 2) Proceed if in a WordPress loop ( https://codex.wordpress.org/Function_Reference/in_the_loop )
// 3) Proceed if global var $dslc_should_filter is true
// Irrelevant of the other 3 proceed if archives, search or 404 page.
if ( ( $curr_id == $real_id && in_the_loop() && $dslc_should_filter ) || ( is_archive() && $dslc_should_filter ) || is_author() || is_search() || is_404() ) {
if ( ( $curr_id == $real_id && in_the_loop() && $dslc_should_filter ) || ( is_archive() && $dslc_should_filter ) || is_author() || is_search() || is_404() || is_front_page() && ! get_option( 'page_on_front' ) ) {

// Variables that are used throughout the function.
$composer_wrapper_before = '';
Expand Down Expand Up @@ -637,7 +637,7 @@ function dslc_filter_content( $content ) {
$showing_404_page = dslc_postid_is_404_template( $post->ID );

// If currently showing a category archive page.
if ( is_archive() && ! $showing_404_page && ! is_author() && ! is_search() ) {
if ( is_archive() && ! $showing_404_page && ! is_author() && ! is_search() || is_front_page() && ! get_option( 'page_on_front' ) ) {

$post_type_slug = get_post_type();
$post_id = $post->ID;
Expand Down
3 changes: 3 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ In most of the cases, this is because the homepage is not a real WordPress page,
* 🦊 [Check out our WooCommerce Page Builder Extension](https://livecomposerplugin.com/downloads/woocommerce-page-builder/?utm_source=wp-admin&utm_medium=changelog&utm_campaign=woo-integration)
* 👀 [We keep updating and improving our extensions pack](https://livecomposerplugin.com/downloads/extensions/?utm_source=wp-admin&utm_medium=changelog&utm_campaign=add-ons) ACF + CPT + MegaMenu + 9 more add-ons.

= 1.4.6 - June 18 2019 =
* Fixed broken posts listing on the home page when WP Admin > Settings > Front Page isn't set.

= 1.4.5 - June 14 2019 =
* Code clean-up and improvements.

Expand Down

0 comments on commit fea5fd3

Please sign in to comment.