Fixing Duplicate Archives and Categories in WordPress Lightning Theme

English

By default, the Lightning theme displays categories twice on single post pages. Also, even though I set the homepage to a 2-column layout, it wouldn't display correctly, and changing the settings had no effect—it made no sense at all. Upon closer inspection, I found that the layout structure between the homepage and post pages felt inconsistent and a bit hard to understand. Is this done intentionally to push people into buying the pro version? Here's my analysis of the issue and how to fix it.

The Lightning Display Issue

On mobile, archives and categories appear twice on post pages.

It looks something like this.

[     タイトル      ]
[      本文         ]
[                   ]
[                   ]
[ 前の記事/次の記事 ]
[     最近の投稿    ]
[     カテゴリー    ]
[     アーカイブ    ]
[     カテゴリー    ]
[     アーカイブ    ]

Why?! Lightning spec?!

Cause: The sidebar drops to the bottom on mobile views

If you look at the desktop version, you'll understand—on mobile, the sidebar seems to be designed to wrap around to the bottom.

[     タイトル      ][  サイドバー ]
[      本文         ][             ]
[                   ][  カテゴリー ]
[                   ][  アーカイブ ]
[ 前の記事/次の記事 ]
[     最近の投稿    ]
[     カテゴリー    ]
[     アーカイブ    ]

Because the overall page is quite long, it didn't feel completely out of place at first, but either way, displaying the same information at the bottom of the main text and in the sidebar is redundant on both desktop and mobile views.

The Solution

Since I've customized the sidebar quite a bit, I want to keep it as is. Naturally, the logical step is to just remove the section at the bottom of the main content, but that's where another weird quirk comes in.

After doing some digging, I found that the area below the main text uses the 'Footer Top (Common across all screens)' widget area to display category and archive blocks. On the other hand, based on my previous code tweaks, the sidebar relies on Lightning's default behavior where PHP handles the display if no sidebar widgets are explicitly configured.

[     タイトル      ][  サイドバー ]
[      本文         ][             ]
[                   ][             ]
[                   ][             ]
[ 前の記事/次の記事 ]
[     最近の投稿    ]
[ウィジット-フッター上部]

So, deleting these category and archive blocks from the widget area should do the trick... Time to tinker with widgets for the very first time.

Ah, this must be it.

Oh nice, the layout is right there. Let's delete these blocks and clean things up.

The Homepage Looks Broken

Or so I thought—the post pages ended up looking just the way I wanted. However, the homepage looked messed up. For some reason, the sidebar disappeared entirely from the homepage, and categories and archives were nowhere to be found... Toggling 1-column or 2-column layout settings made zero difference for some reason.

Investigating and Fixing the Homepage

Looking closely at the widget settings screen, it appears that sidebars are separated by page types. This means the homepage sidebar (which has no widgets set by default) and the post page sidebar (where widgets aren't set by default → Lightning renders them via code) are two completely different things. I'm pretty sure the sidebar code I previously tweaked was only meant for posts. What's really confusing is that the homepage vertically stacks [Main Text] → [Categories] → [Archives], whereas post pages display [Categories] and [Archives] in the sidebar. Make up your mind and keep it consistent!

So, as a temporary fix, all I need to do is create a dedicated 'Sidebar (Homepage)'. Since this applies only to the homepage, it won't affect post pages and won't cause any duplicate displays. You can set this up just like writing a post by adding a block and searching for 'Categories' or similar. Gotta love WordPress for making this easy.

Conclusion

At the end of the day, what's the best way to handle this?

With this setup, post page sidebars are rendered via Lightning's PHP code, while homepage sidebars are rendered using widget blocks.
That said, while the visual issue is resolved, the underlying structural inconsistency remains. The original goal was to 'shorten the archive display,' and that fix still needs to be applied to both. Wondering if I should just make the homepage use the custom code-driven sidebar as well?

Leave a Reply