Keeping one entry at top of list of entries

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
kingofsicily
Regular
Posts: 30
Joined: Thu Jul 29, 2010 4:12 pm
Location: Arnhem, Netherlands

Keeping one entry at top of list of entries

Post by kingofsicily »

Hi there!

On one of my websites I use one page to publish different texts as a sort of portfolio. Is it possible to keep one entry (the 'introduction' to the portfolio) at the top without having to reset the date each time I add a new entry to the page AND without this 'introductory entry' appearing in the 'recent entries event plugin' each time I reset the date?

This is the page:
http://www.woordvoorwoord.com/serendipi ... -Portfolio

Thanks (again ;)),

Rogier.
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Keeping one entry at top of list of entries

Post by Timbalu »

The easiest way I can think of this morning is to have it hardcoded in your entries.tpl, if there isn't a plugin available where you can make startpages for categories.
~like:

Code: Select all

{if $category.category_name == 'Digitaal-Portfolio'}<p>your text</p>{/if}
Or maybe it could be worth to improve the 'recent entries event plugin' or use it as a copy for your needs?
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Keeping one entry at top of list of entries

Post by yellowled »

Timbalu wrote:if there isn't a plugin available where you can make startpages for categories
I'm not sure if the categorytemplates plugin can do that since I tend to avoid using it, but basically, the needed functionality is a sticky entry per category. I'm also not sure if this is possible with just some config setting and/or without hardcoding, but should't it suffice to not display sticky entries on the index page?

YL
kingofsicily
Regular
Posts: 30
Joined: Thu Jul 29, 2010 4:12 pm
Location: Arnhem, Netherlands

Re: Keeping one entry at top of list of entries

Post by kingofsicily »

Hi guys, thanks for your quick response.

Unfortunately, Ian, (as I also replied in a different topic ;)), my programming skills are merely quite basic. So where can I place your code (if it is the proper code in the first place)?

And YL, I'm not sure what you mean by:
should't it suffice to not display sticky entries on the index page
What is the index page? The 'introductory entry' on the page? The index formed by the 'recent entries plugin'? What happens if I don't 'display sticky entries on the index page'?

Thanks again!

Rogier.
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Keeping one entry at top of list of entries

Post by Timbalu »

Sorry I never used the categorytemplates plugin before, it looks like it could serve your wishes, but might be quite a overhead to just give a small intro to one single category in a more or less static web page. The hardcoding way should be... (untested)
Find this in your entries.tpl

Code: Select all

            {if $entry.categories}
                <span class="serendipity_entryIcon">
                    {foreach from=$entry.categories item="entry_category"}
                        {if $entry_category.category_icon}
                            <a href="{$entry_category.category_link}"><img class="serendipity_entryIcon" title="{$entry_category.category_name|@escape}{$entry_category.category_description|@emptyPrefix}" alt="{$entry_category.category_name|@escape}" src="{$entry_category.category_icon}" /></a>
                        {/if}
                    {/foreach}
               </span>
            {/if}
  
            <div class="entry-content serendipity_entry_body">
                {$entry.body}
and replace it somehow like this:

Code: Select all

            {if $entry.categories}
                    {foreach from=$entry.categories item="entry_category"}
                        {if $entry_category.category_icon}
                <span class="serendipity_entryIcon">
                            <a href="{$entry_category.category_link}"><img class="serendipity_entryIcon" title="{$entry_category.category_name|@escape}{$entry_category.category_description|@emptyPrefix}" alt="{$entry_category.category_name|@escape}" src="{$entry_category.category_icon}" /></a>
               </span>
                        {/if}
                        {if $entry_category.category_name == 'Digitaal-Portfolio'}
                <span class="serendipity_mycatIntro">
                <blockquote>Mijn Portfolio bevat een selectie van door mij geschreven teksten en dient ter illustratie voor de mogelijkheden die ik als freelance tekstschrijver bied. Het bevat teksten over verschillende onderwerpen die mij interesseren. Ik voeg regelmatig nieuwe teksten toe, zodat er een gevarieerde verzameling ontstaat.<br />
<br />
Tevens publiceer ik regelmatig op de website van mijn andere bedrijf, mijn coachingspraktijk. Zie daarvoor <a onclick="_gaq.push(['_trackPageview', '/extlink/www.rogierdejongcoaching.nl/index.php?/categories/6-Inspiratie']);"  target=blank href="http://www.rogierdejongcoaching.nl/index.php?/categories/6-Inspiratie"><u><strong>Inspiratie</strong></u></a> en <a onclick="_gaq.push(['_trackPageview', '/extlink/www.rogierdejongcoaching.nl/index.php?/categories/8-Nieuws']);"  target=blank href="http://www.rogierdejongcoaching.nl/index.php?/categories/8-Nieuws"><u><strong>Nieuws</strong></u></a>.</blockquote>
               </span>
                        {/if}
                    {/foreach}
            {/if}
  
            <div class="entry-content serendipity_entry_body">
                {$entry.body}
and in style or user.css

Code: Select all

.serendipity_mycatIntro { /*your own CSS code to support your Intro box*/ }
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
kingofsicily
Regular
Posts: 30
Joined: Thu Jul 29, 2010 4:12 pm
Location: Arnhem, Netherlands

Re: Keeping one entry at top of list of entries

Post by kingofsicily »

Thanks for the suggestion, but indeed this seems to become quite complex for only a few lines of text. I have been experimenting with your suggested code, but it didn't seem to work (I won't deny it is possible I did something wrong, but I checked everything several times...).

I also tried the categories templates plugin, but I'm not sure I understand how it works. As far as I understand, you can define an entry title that has to stay on the front page of the category. You can do that where the plugin asks for: 'Entries to display on category frontpage' (behind which you can manually enter a title). However, each time I click on the save button, the entered title disappears.

Do you (or anyone) know what happens here?

Many thanks!

Rogier.
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Keeping one entry at top of list of entries

Post by yellowled »

kingofsicily wrote:What is the index page? […] What happens if I don't 'display sticky entries on the index page'?
The index page is the start page of your blog. Usually, sticky entries would be displayed here. Now, if you had the possibility to have a sticky entry per category, these would usually also be displayed on the start page, resulting in a list of sticky entries, which is not what you want. So if this would be possible, you'd have to remove sticky entries from the start page.

YL
Mangek
Regular
Posts: 85
Joined: Tue Jun 24, 2008 1:08 am
Location: Sweden
Contact:

Re: Keeping one entry at top of list of entries

Post by Mangek »

The Extended properties for entries-plugin has the option to hide posts from article overview / frontpage. I've used this before and it works pretty well.

The only "drawback" is that they still show up in searches, personally I would have liked the option to hide from that as well. (Perhaps this can be looked into? :D)
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Keeping one entry at top of list of entries

Post by Timbalu »

The real overhead would be to have the categorytemplates plugin installed for this case only.... (every plugin without being really needed is an overhead)

But, oh yes, the extended properties is a must have plugin. I forgot about to mention and did not look up. It has the serendipity[properties][is_sticky] and the serendipity[properties][no_frontpage] checkboxes, which should do what you want, at least they'll set you on the way. Just install this plugin, open the intro entry and save it to be a sticky entry.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Keeping one entry at top of list of entries

Post by Timbalu »

Mangek wrote:The only "drawback" is that they still show up in searches, personally I would have liked the option to hide from that as well. (Perhaps this can be looked into? :D)
Why dont you use a custom field for this purpose, like {$entry.properties.ep_nosearch} and edit your entries.tpl (~like this) to only display entries in search cases
{if $smarty.get.serendipity[action]=='search'}{if !$dategroup.nosearch}ouput entries{/if}{/if}, which do not have this flag.

Edit:
even easier to work with these vars
{if $searchresult_results and not $dategroup.is_sticky}
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Mangek
Regular
Posts: 85
Joined: Tue Jun 24, 2008 1:08 am
Location: Sweden
Contact:

Re: Keeping one entry at top of list of entries

Post by Mangek »

Timbalu wrote:...
Edit:
even easier to work with these vars
{if $searchresult_results and not $dategroup.is_sticky}
I'll take a look! Thanks for the heads up. :)
kingofsicily
Regular
Posts: 30
Joined: Thu Jul 29, 2010 4:12 pm
Location: Arnhem, Netherlands

Re: Keeping one entry at top of list of entries

Post by kingofsicily »

Thanks so much for thinking along! That is exactly it! At first I was confused since the sticky post also appears in the recent entries plugin (which I don't want), but when you publish new entries afterwards (and after resetting the dates of the already published entries) the sticky post title will move to the next position, and the next, and the next... until it disappears from the Recent Entries nugget on the site (no doubt the plugin still keeps track of it).

Once again I am amazed by Serendipity's possibilities and simplicity.

I am a big fan :D.

Many, many thanks!

Rogier.
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Keeping one entry at top of list of entries

Post by Timbalu »

Good to hear!
It would have been easier to just give the sticky intro a date far in the past, so it falls behind the last 5, which is ok in your case, while you already have enough entries in this category. For others, another option to pass by sticky entries would be needed in the recent entries plugin...
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Post Reply