Opened 13 years ago
Closed 13 years ago
#4141 closed enhancement (fixed)
Wrapper Function for getting the currently displayed page url.
Reported by: | chrisclayton | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 1.6 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Core | Keywords: | |
Cc: |
Description
We need a template function for returning the current page url as get_permalink() doesn't work with buddypress generated pages.
See here for history: http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/current-url/
Attachments (1)
Change History (8)
#1
@
13 years ago
- Keywords dev-feedback removed
I think the idea might have merit, but for implementation, I'd reconstruct the current URL through the $bp->canonical_stack. Maybe something like bp_rel_canonical() which I put into trunk a couple weeks ago.
#3
@
13 years ago
Agreed. Knew there was a reason i wanted advice :) Don't think i was too confident in that patch.
Haven't tested it and i could be reading it wrong, but looking through the bp_rel_canonical function (thanks btw, somehow i missed that update) it already seems to detect every page possible so, wouldn't we just be repeating the same code in both? (or am i reading it wrong?)
Wouldn't moving the url building stuff into bp_get_permalink() and returning the url_stack and then changing bp_rel_canonical() to simply just echo the bp_get_permalink()?
echo "<link rel='canonical' href='" . bp_get_permalink() . "' />\n";
Work perfectly, while keeping the DRY (Dont Repeat Yourself) principle intact?
#4
@
13 years ago
Yes, you're right that the canonical logic should be separated out and not repeated. bp_get_permalink()
may not be the best name for such a function, though, as it's not really parallel to get_permalink()
(which is used inside of the post loop or can be fed a post/post_id, and does not refer to the current page).
#5
@
13 years ago
- Milestone changed from Awaiting Review to 1.6
- Owner changed from chrisclayton to boonebgorges
- Status changed from new to assigned
#6
@
13 years ago
Yeah, i was just using bp_get_permalink to refer to it by until i came up with something better. :)
Not finished, needs work and advice.