Support Forum

Recent Posts Widget

CH Chris Hustad
Chris Hustad
Member

On the recent posts widget by default, the topic title links to the most recent comment in the post itself.

Is there any way to just have it display just the topic itself?  I’m assuming this will be much better for SEO purposes.

Thanks!

14 Answers

New Answer

BR Brandon
Brandon
Member

There isn’t an option to display the whole post. If it were to display the whole topic it would take up a lot of room on a page or sidebar.  In most cases that would mean you would only be able to show one or two.

SEO wise you are probably better off with more internal links so the bots go to them and index.

The most important thing though is what would keep your users on the site and get you more pageviews? Google Analytics and webmaster will see what pages are viewed the most and take that into account too.

BR Brandon
Brandon
Member

What you want then is not the recent posts but recent topics.

There is no widget for that but there is a template tag included in that same plugin.

Take a look at the info on http://codex.simple-press.com/codex/plugins/our-plugins/the-template-tags-plugin/template-tag-newest-topics/ and it will show you how you can use by using php or a shortcode.

 

CH Chris Hustad
Chris Hustad
Member

Brandon C said
What you want then is not the recent posts but recent topics.

There is no widget for that but there is a template tag included in that same plugin.

Take a look at the info on http://codex.simple-press.com/codex/plugins/our-plugins/the-template-tags-plugin/template-tag-newest-topics/ and it will show you how you can use by using php or a shortcode.

 

I went in and added <?php sp_NewestTopicsTag();?> into a widget (added php capability) and it displays exactly as the recent posts widget.  It links to the latest post inside the topic, NOT the topic URL itself.

All I want is a list of the latest 10 topics from the forum, linked to the topic URL.  Can I be a pain and ask for a little php help in accomplishing this?

Thanks,

Chris

MP Mr Papa
Mr Papa
Member

you are going to have to be more specific…. keep in mind that a topic contains posts… so its more natural to link to a post in the topic… so if you have 15 pages of posts in the topic, where do you want to link to??? the very first page?? which is how I would interpret what you are saying… the last post? the last page?

and for the record, the newest topics and recent post do different things… the recent posts returns the most recent posts irregardless of the topic – so you may get multiple posts in the same topic… the recent topics, return the most recent topics with an update… so if you have more than one recent post in a topic (within your specified limit), you will get quite different results… of course, its possible they will return the same list too… yes, the recent posts links to the specific post… the recent topics links to the last post in the topic because thats where everyone wants to go – read the latest…

so depending on how you answer my questions, we may or may not have something built in to do what you specifically want…

MP Mr Papa
Mr Papa
Member

sorry, wanted to add one more thing… you say latest 10 topics… what do you define as latest… the newest topics template tag will can give the 10 latest topics in the forum… latest being defined as a topics with the latest post whether first, 5th, 10th or whatever… the link will be to that latest post in the topic… which will still be the normal full list of posts for that page…

CH Chris Hustad
Chris Hustad
Member

Yes, I want the newest 10 topics.

If there are, say, 5 pages of posts I still want it to link to the first page (original topic URL).

I hope I make sense. :-)

MP Mr Papa
Mr Papa
Member

its clearer now, yes…  but afraid we dont have anything built in that does that…  frankly, we have not ever had anyone that I can recall request such a thing…  99.9% of the folks want go to the last post for obvious reasons…

but we might be able to use our api and hooks and filters to get you what you want…

first, use the newest topics template tag like recommended before…  if you only want it for a specific forum, remember to add the forum id argument(see http://codex.simple-press.com/codex/plugins/our-plugins/the-template-tags-plugin/template-tag-newest-topics/)….   then add this code to our spFunctions.php of your sp theme (as always this should be yours – see: http://codex.simple-press.com/codex/themes/theme-basics/creating-a-theme/):

add_filter('sph_NewestTopicsTag_args', 'my_newestopics_args');
 function my_newestopics_args($args) {
     add_filter('sph_post_list_record', 'my_query_filter', 10, 2);
     return $args;
 }
 
 function my_query_filter($list, $record) {
     remove_filter('sph_post_list_record', 'my_query_filter', 10, 2);
     $list->post_permalink = sp_build_url($record->forum_slug, $record->topic_slug, 0);
     return $list;
 }

playing a little double filter dance there to keep from affecting other uses of the list post class…  must also say I have not tested this…

CH Chris Hustad
Chris Hustad
Member

That worked well. Thank you for the quick response and for providing me with a solution.

CH Chris Hustad
Chris Hustad
Member

I spoke too soon….hehe

It works for the most recent topic…but the rest in the “list” link to the most recent post.

http://www.werejustparents.com/  (See bottom right hand corner in sidebar)

Site is in BETA – so no hurries.

MP Mr Papa
Mr Papa
Member

take out the remove_filter line… 

shouldnt be removed until after all have been done… and then add this in:

apply_filters('sph_NewestTopicsTag', 'my_query_remove');
function my_query_remove($out) {
    remove_filter('sph_post_list_record', 'my_query_filter', 10, 2);
    return $out;
}