List view in default theme?

Post Reply
kr428
Sr. Bludit
Posts: 35
Joined: Thu Jan 05, 2023 9:07 pm
Has thanked: 11 times
Been thanked: 2 times

Alls;
just stumbled into bludit after considering wordpress more and more too big for my tiny personal blogging needs these days, so far like what I see and pretty much admired the wordpress importer too. However, a mostly simple first question for that: I used / tried the two standard themes which are pretty good already, but I would like to not have all full posts on the start page but just a link, maybe image, and maybe teaser text if the article has set one. Is that something that's possible by configuration somewhere, or does it need change on the template code?
Thanks and best,
Kristian
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

kr428 wrote: Fri Jan 06, 2023 8:09 am However, a mostly simple first question for that: I used / tried the two standard themes which are pretty good already, but I would like to not have all full posts on the start page but just a link, maybe image, and maybe teaser text if the article has set one. Is that something that's possible by configuration somewhere, or does it need change on the template code?
There are severeal "scenarios".

1) Title

Use the following code to display the title:

Code: Select all

<!-- Page title -->
<a class="text-dark" href="<?php echo $page->permalink(); ?>">
   <h2 class="title"><?php echo $page->title(); ?></h2>
</a>
If you want for example display only the title using the theme Alternative you have to modify the code of the file home.php in the directory /bl-themes/alternative/php (line 51).

Use

Code: Select all

				<!-- Page title -->
				<a class="text-dark" href="<?php echo $page->permalink(); ?>">
					<h2 class="title"><?php echo $page->title(); ?></h2>
				</a>
instead of

Code: Select all

				<!-- Page title -->
				<a class="text-dark" href="<?php echo $page->permalink(); ?>">
					<h2 class="title"><?php echo $page->title(); ?></h2>
				</a>

				<!-- Page description -->
				<?php if ($page->description()): ?>
				<p class="page-description"><?php echo $page->description(); ?></p>
				<?php endif ?>

				<!-- Page content until the pagebreak -->
				<div>
				<?php echo $page->contentBreak(); ?>
				</div>

				<!-- Shows "read more" button if necessary -->
				<?php if ($page->readMore()): ?>
				<div class="text-right pt-3">
				<a class="btn btn-primary btn-sm" href="<?php echo $page->permalink(); ?>" role="button"><?php echo $L->get('Read more'); ?></a>
				</div>
				<?php endif ?>
2) Cover image

The cover image is only used by the theme Blog X. To add it to the theme Alternative use the following:

Code: Select all

<!-- Cover image -->
<?php if ($page->coverImage()): ?>
<img class="card-img-top mb-3 rounded-0" alt="Cover Image" src="<?php echo $page->coverImage(); ?>"/>
<?php endif ?>
3) Teaser text

There are two possibilities.

You can use the text before the page break of the content of your page or post. In the editor TinyMCE there is a button to insert a page break.

You can also use the field "Description" (if you edit a content at "Options" > "General"). This field is displayed with the following code:

Code: Select all

<!-- Page description -->
<?php if ($page->description()): ?>
<p class="page-description"><?php echo $page->description(); ?></p>
<?php endif ?>
The theme Alternave has this code (line 56). You can add it also to theme Blog X.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
kr428
Sr. Bludit
Posts: 35
Joined: Thu Jan 05, 2023 9:07 pm
Has thanked: 11 times
Been thanked: 2 times

Wow, cool, that's amazing, thanks very much! :)
Post Reply