-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update the embed format. #59
Conversation
Increase contrast on text; move hook punctuation into the span (so it's also green); use a code font for the heading
This is looking good! I started playing with it locally so I hope you don't mind that I made a few changes to the CSS.
|
$title = get_the_title(); | ||
$has_args = count( get_params( $post_id ) ) > 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ryelle Why this change? I didn't want to make get_params
a dependency of get_signature
seeing that its values are not used. Although there are no tests, it does make it less testable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, I left my reasoning in the commit, not the comment — I did that so it would match the main theme's template tag (e52a950). It also surprised me that you would need to tell get_signature
that the function has args, it seems like something that should be detected in the function (since usually it would also output those params - though I know it doesn't here).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. I think I would prefer to have it less similar than more. Maybe it makes more sense to create a truncated form of the function in template-tags.php
since it does appear like we'll be keeping the signature around as it is with some modifications.
What about something like:
function get_truncated_signature() {
return get_signature( ..., true )
}
...
function get_signature( ..., truncate = false ) {
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, if we might use it elsewhere, I like your suggestion 👍🏻
These look great! The hook stuff has got me thinking about the way we display those in the headline, ie That is definitely clearer than displaying just the hook name. And it'll definitely make some people happy. But it feels kind of backwards to me, and I wonder if some other people might feel the same. What I mean is, in the function reference, the title/headline represents the code I should write in order to use the function, more or less. Whereas with the hooks, the headline represents the code core uses to call the hook, not the code I should write. Perhaps both of these would be solved by having a one-line example immediately below the headline for every function, hook, etc. Something like: apply_filters( 'pre_wp_filesize', ... )
..where the example line is syntax highlighted and easily copyable. We could also allow multiple examples, ref #12 (comment) |
with #12 in mind, this would work well for hooks IMHO, but I'd expand that to have the function in there too:
|
I agree that for hooks |
Closes: #34
This PR updates the embed layout by creating an
embed.php
file and serving a custom embed view.Changes:
function
add()
hook
, apply the correctfunction
that wraps it.hook
offunctions
has arguments, add...
to denote parameters> 4
truncateThere are no examples of classes, and this wasn't tested on "classes" because of #35. This PR should probably wait for that bug fix.
If you think there is more pertinent information to add to the embed that is missing, please comment below!
Screenshots