Notifications
Clear all

wpForo 1.x.x [Closed] Google XML sitemap pluging and wpforo. How to insert topics on sitemap

5 Posts
4 Users
2 Likes
2,854 Views
enricocantori
Posts: 16
Topic starter
(@enricocantori)
Eminent Member
Joined: 6 years ago

Hi to all, I write a little script to insert topics on Google XML sitemap plugin.

You have to add this script in Google XML sitemap plugin. Exactly on the file sitemap-ui.php

This is the code:

// ADD TOPICS TO SITEMAP
$posts_args = array(
'orderby' => 'created',
'order' => 'DESC',
);
$topics = WPF()->topic->get_topics_filtered($topic_args);
foreach( $topics as $topic ){
$topic_url = wpforo_topic($topic['topicid'], 'url');
$topic_url_ok = esc_url($topic_url);
// $topic_url_html = esc_html($topic['title']);
// $topic_created = esc_html(wpforo_date($topic['created']));
// $member = wpforo_member($topic);
// $member_link = wpforo_member_link($member);
// $avatar = WPF()->member->avatar($member);
$p2=new GoogleSitemapGeneratorPage();
if(substr($topic_url_ok,0,4)=="www.") $topic_url_ok="http://" . $topic_url_ok;
$p2->SetUrl($topic_url_ok);
$p2->SetProprity('0.8');
$p2->SetChangeFreq('weekly');
$p2->setLastMod(0);
//Add it to the array
array_push($pages,$p2);
}
// ADD TOPIC TO SITEMAP

 

You have to add the code before the last line of the function:  public function HtmlApplyPages()

<<< HERE

return $pages;

 

This hook will add topics to this sub-sitemap:

sitemap-externals.html

 

Hope this can helps other peoples.

www.carloscastanedaforum.com

 

4 Replies
Robert
Posts: 10503
Admin
(@robert)
Support Team
Joined: 8 years ago

Please wait for next wpForo release. We're currently working on wpForo sitemap. It'll be available soon.

Posts: 10
(@cristiano)
Active Member
Joined: 7 years ago
Posted by: Robert

Please wait for next wpForo release. We're currently working on wpForo sitemap. It'll be available soon.

What excellent news! Thanks!

Posts: 3
(@marcodiversi)
New Member
Joined: 6 years ago
Posted by: Robert

Please wait for next wpForo release. We're currently working on wpForo sitemap. It'll be available soon.

very nice!

this plugin is going to be a massive revolution!

Keep it up!

Robert
Posts: 10503
Admin
(@robert)
Support Team
Joined: 8 years ago

@enricocantori, @marcodiversi

wpForo built-in sitemap is already available with just released 1.5.2 version. More info in release summary: https://wpforo.com/community/wpforo-announcements/wpforo-1-5-2-is-released/