I’ve been trying to figure out how to display full posts on the home page, and excerpts on all archives for about 3 days. This is nice because it means a decent amount of each post is shown on the front page, whilst archive pages contain a much more concise summary of each post. This is better both for humans, and also for この — my archive pages now don’t have duplicate content from my home page!
I’ve finally produced a solution. It’s not especially elegant, but I’ve been at the very limit of my PHP knowledge just to achieve this method. This applies specifically to the Mystique 3 テーマ, other themes are likely to vary, although some of this information may or may not prove relevant. If you are trying or succeed in doing the same to a different theme do drop a comment in.
How it currently works
Mystique has options which allow the admin to choose whether to display excerpts or full posts. This option is stored as $post_content_mode inside the $options array.
The file archive.php displays the archive and displays each post in a loop via teaser.php
teaser.php has the line
[PHP]<?PHP (is_sticky() && is_home()) ? the_content() : $app->ポスト>コンテンツ(); ?>[/PHP]
This line generates the content via a call to the function getContent in the file AtomObjectPost.php. If this line is commented the post contents disappear from archive pages.
The getContent function loads $options and as a results either calls the_content() or the_excerpt() which are wordpress built-in functions.
ソリューション
I’ve managed to achieve what I wish by modifying teaser.php — but its a bit of a botch job I think. I just replaced
[PHP]<?PHP (is_sticky() && is_home()) ? the_content() : $app->ポスト>コンテンツ(); ?>[/PHP]
とともに
[PHP]<?PHPの場合(is_home()): ?>
<?PHP (is_sticky() && is_home()) ? the_content() : $app->ポスト>コンテンツ(); ?>
<?他のPHP: ?>
<?PHP (is_sticky() && is_home()) ? the_excerpt() : $app->ポスト>コンテンツ(‘e’); ?>
<?PHP endifの; ?>[/PHP]
A better solution?
I would rather implement this solution via an addition to functions.php but I have no idea how to do so. My PHP knowledge just isn’t good enough.
“Hi James I realise it has been a long while, but I just checked this on windows 11 (build 23H2)…”