News:

Wondering if this will always be free?  See why free is better.

Main Menu

How to Move only Recent Posts to the Top

Started by peterwaalker, October 19, 2016, 04:19:49 PM

Previous topic - Next topic

peterwaalker

I have tried my best to move RECENT POST to the top but could not. I downloaded, parsed, edited and installed a mod called Move-Recent-Post-To-Top but the recent post refused to show on the top.
For this reason, i have decided to seek for direction with or without a mod.
Please teach me what to do

Dhayzon

#1
that theme you are using?
on theme  default  find in display.template.php
sorry  ;D

edit 
BoardIndex.template.php



// This is the "Recent Posts" bar.
if (!empty($settings['number_recent_posts']) && (!empty($context['latest_posts']) || !empty($context['latest_post'])))
{
echo '
<div class="title_barIC">
<h4 class="titlebg">
<span class="ie6_header floatleft">
<a href="', $scripturl, '?action=recent"><img class="icon" src="', $settings['images_url'], '/post/xx.gif" alt="', $txt['recent_posts'], '" /></a>
', $txt['recent_posts'], '
</span>
</h4>
</div>
<div class="hslice" id="recent_posts_content">
<div class="entry-title" style="display: none;">', $context['forum_name_html_safe'], ' - ', $txt['recent_posts'], '</div>
<div class="entry-content" style="display: none;">
<a rel="feedurl" href="', $scripturl, '?action=.xml;type=webslice">', $txt['subscribe_webslice'], '</a>
</div>';

// Only show one post.
if ($settings['number_recent_posts'] == 1)
{
// latest_post has link, href, time, subject, short_subject (shortened with...), and topic. (its id.)
echo '
<strong><a href="', $scripturl, '?action=recent">', $txt['recent_posts'], '</a></strong>
<p id="infocenter_onepost" class="middletext">
', $txt['recent_view'], ' &quot;', $context['latest_post']['link'], '&quot; ', $txt['recent_updated'], ' (', $context['latest_post']['time'], ')<br />
</p>';
}
// Show lots of posts.
elseif (!empty($context['latest_posts']))
{
echo '
<dl id="ic_recentposts" class="middletext">';

/* Each post in latest_posts has:
board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.),
subject, short_subject (shortened with...), time, link, and href. */
foreach ($context['latest_posts'] as $post)
echo '
<dt><strong>', $post['link'], '</strong> ', $txt['by'], ' ', $post['poster']['link'], ' (', $post['board']['link'], ')</dt>
<dd>', $post['time'], '</dd>';
echo '
</dl>';
}
echo '
</div>';
}
atest_post']['time'], ')<br />
</p>';
}
// Show lots of posts.
elseif (!empty($context['latest_posts']))
{
echo '
<dl id="ic_recentposts" class="middletext">';

/* Each post in latest_posts has:
board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.),
subject, short_subject (shortened with...), time, link, and href. */
foreach ($context['latest_posts'] as $post)
echo '
<dt><strong>', $post['link'], '</strong> ', $txt['by'], ' ', $post['poster']['link'], ' (', $post['board']['link'], ')</dt>
<dd>', $post['time'], '</dd>';
echo '
</dl>';
}
echo '
</div>';
}


Cut  not copy "cut" 


paste after

}
});
// ]]></script>';
}



or paste before

echo '
<div id="boardindex_table">

peterwaalker

I searched throughout public_html/Themes/default/display.template.php file but did not see the code so as to cut & paste as you instructed. I however found the code in the public_html/Themes/default/BoardIndex.template.php. Should i go ahead and modify it as you instructed?

Dhayzon

sorry, BoardIndex.template.php it's correct

peterwaalker

The RECENT-POST refused to go up
See the code i cut & paste before echo '
   <div id="boardindex_table">

// This is the "Recent Posts" bar.
if (!empty($settings['number_recent_posts']) && (!empty($context['latest_posts']) || !empty($context['latest_post'])))
{
echo '
<div class="title_barIC">
<h4 class="titlebg">
<span class="ie6_header floatleft">
<a href="', $scripturl, '?action=recent"><img class="icon" src="', $settings['images_url'], '/post/xx.gif" alt="', $txt['recent_posts'], '" /></a>
', $txt['recent_posts'], '
</span>
</h4>
</div>
<div class="hslice" id="recent_posts_content">
<div class="entry-title" style="display: none;">', $context['forum_name_html_safe'], ' - ', $txt['recent_posts'], '</div>
<div class="entry-content" style="display: none;">
<a rel="feedurl" href="', $scripturl, '?action=.xml;type=webslice">', $txt['subscribe_webslice'], '</a>
</div>';

// Only show one post.
if ($settings['number_recent_posts'] == 1)
{
// latest_post has link, href, time, subject, short_subject (shortened with...), and topic. (its id.)
echo '
<strong><a href="', $scripturl, '?action=recent">', $txt['recent_posts'], '</a></strong>
<p id="infocenter_onepost" class="middletext">
', $txt['recent_view'], ' &quot;', $context['latest_post']['link'], '&quot; ', $txt['recent_updated'], ' (', $context['latest_post']['time'], ')<br />
</p>';
}
//-- Labradoodle-360; Advanced Recent Posts
elseif (!empty($context['latest_posts']))
{
echo '
<table align="center" cellpadding="5" cellspacing="0" width="100%" border="0">
        <tr>
                        <td class="arp_header">', $txt['topic_name'] ,':</td>
                        <td class="arp_header">', $txt['poster_name'] ,':</td>
              <td class="arp_header">', $txt['board_name'] ,':</td>
                        <td class="arp_header">', $txt['post_time'] ,':</td>
                    </tr>';
            foreach ($context['latest_posts'] as $post)
                    {
          echo '
                        <tr>
        <td class="arppost arp_left">', $post['link'], '</td>
        <td class="arppost arp_rest">', $post['poster']['link'], '</td>
        <td class="arppost arp_rest">', $post['board']['link'], '</td>
        <td class="arppost arp_rest">', $post['time'], '</td>
      </tr>';
                    }
        echo '
</table>
                <br />
            ';
}
        // End Labradoodle-360; Advanced Recent Posts --//
echo '
</div>';
}


help me check if something is wrong

peterwaalker

please i'm waiting to hear from you so i can arrange things i have modified half way.

Dhayzon

where exactly you want to move?
What is your forum ? url

peterwaalker

Quote from: Dhayzon on October 20, 2016, 06:59:11 AM
where exactly you want to move?
What is your forum ? url

I want to move recent posts under news fader. Just between newsfader and live chats

peterwaalker

Quote from: peterwaalker on October 20, 2016, 02:38:59 PM
Quote from: Dhayzon on October 20, 2016, 06:59:11 AM
where exactly you want to move?
What is your forum ? url

I want to move recent posts under news fader. Just between newsfader and live chats


Does it mean no body can help me solve this problem?

peterwaalker

Should paste the above code given in the /BoardIndex.template.php. of the custom theme i am using?

Illori

if your custom theme has a BoardIndex.template.php yes it would need to be there to show the change.

peterwaalker

Quote from: Illori on October 23, 2016, 02:36:45 PM
if your custom theme has a BoardIndex.template.php yes it would need to be there to show the change.

I'm happy now. i modified the custom theme BoardIndex.template.php and it worked like charm!
Thanks a lot @Illori
and @Dhayzon

Advertisement: