Notifications
Clear all

Script [Solved] How to add a page template?

8 Posts
3 Users
1 Reactions
3,247 Views
Posts: 21
Topic starter
(@gamedevhq)
Eminent Member
Joined: 5 years ago

Hi, 

I really like how the pages load within the forum. I'd like to add a page template and add some helpful shortcodes my site uses. How can I go about doing this? 

7 Replies
Sofy
Posts: 4802
 Sofy
Admin
(@sofy)
Support Team
Joined: 7 years ago

@gamedevhq,

I don't follow you well. 

As far as I understand you'd like to Enable Shortcodes in Post Content, right? If so just navigate to Dashboard > Forums > Settings > Features admin page and set "Yes" value for the "Enable WordPress Shortcodes in Post Content" option.

Posts: 21
Topic starter
(@gamedevhq)
Eminent Member
Joined: 5 years ago

Hi @sofy

Sorry for the confusion. Basically, I'd like to load a page within the forum. Almost like a template page. 

A great example, is the Profile page that comes with WPForo. I'd like to create a new page that imbeds into this. 

Notice how this page is imbedded within the forum. 

2 Replies
Sofy
 Sofy
Admin
(@sofy)
Joined: 7 years ago

Support Team
Posts: 4802

ok @gamedevhq,

In the case of the profile page, you can use the following shortcode. e.g. loads ID=25 user profile page.

[wpforo item="profile" id="25"]

The wpForo Shortcodes can be found here: https://wpforo.com/docs/root/getting-started/forum-page/wpforo-shortcodes/

(@gamedevhq)
Joined: 5 years ago

Eminent Member
Posts: 21

@sofy

I'm basically asking how I can go about adding a new tab with my own content. 

For example, I want to include the courses they have as a tab. So I would add to the nav bar: Courses

And then when they click it, it would display the courses available to them. I have a short code for it: [showcourses] 

I want it to imbed within the forum template page. Like the profile page. 

Does that make more sense?

Essentially, you have provided us with the following pages: 

Index forum, Profile, Activity, Account, Subscriptions. 

How can I add a new page to this?

Robert
Posts: 10590
Admin
(@robert)
Support Team
Joined: 9 years ago

@gamedevhq

How about the user ID? Is this ia general content or a user ID depended content? Is this the same for all users? If this is a static data you can create a static wpForo Page putting this code in your theme functions.php file:

function wpforo_page_show_courses( $template ){
if( $template == 'courses' ){
?>
<div class="wpforo-page wpforo-page-courses wpforo-text">
<?php echo do_shortcode('[showcourses]'); ?>
</div>
<?php
}
}
add_action( 'wpforo_page', 'wpforo_page_show_courses', 10 );

Then call this page with URL:

 https://example.com/community/?wpforo=page&view=courses 

You can put it in wpForo Menu, using "Custom Links" menu type in Dashboard > Appearance > Menus admin page. use the wpForo Navigation menu.

Posts: 21
Topic starter
(@gamedevhq)
Eminent Member
Joined: 5 years ago

d**n your support is amazing. Worked Perfectly!!!

 

Out of curiosity, if i wanted to add a short code to extend something at the bottom of the profile page, could this be done?

1 Reply
Robert
Admin
(@robert)
Joined: 9 years ago

Support Team
Posts: 10590

Thank you @gamedevhq,

You can customize any page in wpForo. The profile page can be customized as well. However you should use the plugin update safe way. All is described in documentation:

wpForo template customization: https://wpforo.com/docs/forum-themes/theme-customization/

wpForo template files: https://wpforo.com/docs/root/forum-themes/theme-files/

 

You should use profile-home.php file to add shortcode. For example, in profile-home.php file line 97 you can add your shortcode or something else. It'll be displayed right after the statistic boxes on profile home page: