Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ciaran Smith 20 posts 101 karma points
    Feb 16, 2015 @ 19:27
    Ciaran Smith
    0

    Re-order related posts

    Anyone know how to order the related posts so that they are newest to oldest from the top down instead of oldest to newest?

     

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Feb 16, 2015 @ 20:35
    Dennis Aaen
    100

    Hi Ciaran and welcome you our.

    First you need to find the partial view that renders the related post. This partial view is located in here \Views\Partials\uBlogsy\Post\uBlogsyPostListRelatedPosts.cshtml. When you in this file you need to add .OrderBy to the foreach loop so your code look like this.

    <aside class="uBlogsy_related_posts_container uBlogsy_bottom_border uBlogsy_font_style20">
         <h3>@library.GetDictionaryItem("uBlogsyDicPostsRelated")</h3>
            <ul class="uBlogsy_related uBlogsy_font_style20">
                @foreach (var n in nodes.OrderBy("uBlogsyPostDate desc")){
                    <li><a href="@n.Url()" title="@n.GetPropertyValue("uBlogsyContentTitle")"><span>@n.GetPropertyValue("uBlogsyContentTitle")</span>
                        </a>- <span class="uBlogsy_post_date">@(n.GetPropertyValue<DateTime>("uBlogsyPostDate").ToString("d MMMM yyyy"))</span>
                    </li>
                }
            </ul>
    </aside>

    Hope this helps,

    /Dennis

  • Ciaran Smith 20 posts 101 karma points
    Feb 17, 2015 @ 12:44
    Ciaran Smith
    0

    Hi Dennis,

    This works, thanks for this.

    I have now noticed however that the related posts are the exact same for all of my blogs posts - do you know how this feature actually works?

    Thanks

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Feb 17, 2015 @ 12:52
    Dennis Aaen
    0

    Hi Ciaran,

    Great to hear that it works with the sorting. I donĀ“t know how the feature actually works. I think you should create a new post, so we keep the thead clean about how to re-order the post.

    - You can mark the question as solved by clicking the green tick beside the avatar picture, for the post with the right answer.

    Hope this helps, so just create another question, and perhaps others can help you out or Anthony Dang

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft