#6486 closed defect (bug) (fixed)
'bp_template_title' h3 element should be more selectable/flexible
Reported by: | boonebgorges | Owned by: | r-a-y |
---|---|---|---|
Milestone: | 2.4 | Priority: | normal |
Severity: | normal | Version: | 1.2 |
Component: | Templates | Keywords: | has-patch reporter-feedback commit |
Cc: |
Description
When using members/single/plugins.php to display custom component content, there's a bit of markup that looks like this:
<h3><?php do_action( 'bp_template_title' ) ?></h3>
To create a title for this kind of page, you add_action( 'bp_template_title', 'my_component_page_title' );
and echo your title.
Aside from being generally inelegant, this system poses problems for plugins that want to omit a title. If you don't hook anything to 'bp_template_title'
, you get an empty <h3></h3>
element, which takes up vertical space. There's not even a great way to hide it using CSS, because it doesn't have any specific selectors.
I suggest first that we add a selector - something like class="bp-plugin-page-title"
. Better suggestions for selector names are welcome.
Better still, but more complicated: we should not show the <h3>
element if there's nothing to put inside of it. Not sure how to do this without breaking backward compatibility. Maybe: fire 'bp_template_title' in an output buffer, and check its content before generating the markup.
Attachments (1)
Change History (13)
#2
in reply to:
↑ 1
@
9 years ago
Replying to r-a-y:
We can check with
has_action()
perhaps before outputting.
Good idea.
Only problem is looking for the valid title callback for the page in question.
In all my plugins, I only add_action()
when I already know it's the right context. But maybe there are others that don't do this. If there are, then this can't be solved either with has_action()
or output buffers. Phooey.
#3
@
9 years ago
Either the markup should stay in the template and plugins should use custom template parts if need be, or we should build a title wrapper function that's also responsible for generating the markup, classes, etc...
#4
@
9 years ago
- Keywords has-patch added
- Version set to 1.2
01.patch
uses the has_action()
approach.
we should build a title wrapper function that's also responsible for generating the markup, classes, etc...
A wrapper function would be nice for plugins to replace the <h3>
element with something else.
This ticket was mentioned in Slack in #buddypress by boone. View the logs.
9 years ago
#8
@
9 years ago
- Keywords commit added
01.patch is a definite improvement on what we currently have, and it requires minimal changes. Let's go with it.
#9
@
9 years ago
- Owner set to r-a-y
- Resolution set to fixed
- Status changed from new to closed
In 10213:
This ticket was mentioned in Slack in #buddypress by boone. View the logs.
9 years ago
#11
@
9 years ago
Just to note we have this same or similar issue with action buttons in areas like the groups headers which I've been puzzling over a solution for as it does interfere with layout sections. We could do with a generic approach to the do_actions where we don't wrap them in markup.
We can check with
has_action()
perhaps before outputting.Only problem is looking for the valid title callback for the page in question.