Opened 11 years ago
Closed 11 years ago
#2052 closed enhancement (fixed)
New Shortcode: Forum Statistics
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 2.3 | Priority: | normal |
Severity: | normal | Version: | 2.2 |
Component: | API - Shortcodes | Keywords: | has-patch needs-ui |
Cc: | wordpress@… |
Description
Introduce new bbPress shortcode [bbp-statistics] for bbPress Forum Statistics
Utilizing existing page template /extras/page-forum-statistics.php
Attachments (3)
Change History (11)
#2
@
11 years ago
- Cc wordpress@… added
The get_template_part won't work here because if you check templates/default/extras/page-forum-statistics.php, that's a full template, with header, footer, and all.
Probably we should create a new function that returns the statistics and use that function both in the template and in the shortcode.
#3
follow-up:
↓ 4
@
11 years ago
Hmmmmm... WordPress templating sink or swim time ;)
eg. bbp-lost-pass shortcode calls form-user-lost-pass.php
The form-user-lost-pass.php also has get_header(); ?> <?php get_sidebar(); ?> <?php get_footer(); ?> and is basically the same code except for what is inside the <divs> yet this works fine.
Is this because page-forum-statistics.php is a 'page' template whereas form-user-lost-pass.php is a 'form' template?
EDIT: p.s. Thanks for the reply and info
#4
in reply to:
↑ 3
@
11 years ago
Replying to netweb:
eg. bbp-lost-pass shortcode calls form-user-lost-pass.php
The form-user-lost-pass.php also has get_header(); ?> <?php get_sidebar(); ?> <?php get_footer(); ?> and is basically the same code except for what is inside the <divs> yet this works fine.
uhmm nop. It's just a form. Click again in the file you posted :)
Is this because page-forum-statistics.php is a 'page' template whereas form-user-lost-pass.php is a 'form' template?
Yes. When you load that template inside the shortcode, basically you're doing an inception thing. And what's worst, that template calls the_content(), so you get an infinit loop, because the_content() loads that same shortcode again.
What we need to do IMHO is get the code from line 30 to line 92 of page-forums-statistics.php into a new template part, and then call this new template part both from page-forums-statistics.php and the shortcode.
#5
@
11 years ago
- Keywords has-patch added
2052.2.diff implements the shortcode.
Doesn't look very good, probably it needs some better markup / styles, but that's far from my strong suit.
The attached 2052.diff is as far as I can get :(
I am presuming 'something' else regarding the actual page template needs to be initialized 'somewhere' else, any clues on what else needs to be done would be welcomed and I'll happily have a go at it. :)