-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Covering All Features of Template Tags in Full Site Editing (FSE) #22724
Comments
Instead of making many blocks for template tags, it would be much better to have dynamic data connecting / mapping to basic blocks: For example:
Another good thing is that users can choose which block they want to connect to. For example, users can connect post author to a paragraph block if they want to display it as a normal text or a heading block if they want to display it as a heading tag. |
That would be manipulating the sources of attributes through a UI. I find it hard to imagine a UI where that wouldn't be overwhelmingly technical. Do you have any ideas? We also have to keep in mind that attribute types are not directly compatible with the sources in question. A lot of these blocks process things before saving them or hide specific options that their sibling "regular" blocks have. For example, the post title, can't and doesn't support all the features of a heading. |
@epiqueras Yes, the UI might be the hardest part. I found the Beaver Themer team and Elementor Pro do this quite well. Here is a screenshot from Beaver Themer for reference: Basically, they have a "toggler" near the input and clicking that shows list of supported sources. Agree with the attributes/features. |
I took a look at the theme we most recently developed, and noted which tags appeared that don't have an existing block in progress development to cover its functionality. Starred what I thought might be most useful to prioritize:
|
Posting a summary of our review during a block-based themes meeting: General:The loginout things would be useful to add login/logout links, but then again that would probably be most useful as a sub-item in the navigation block. Bookmark:These are no longer relevant Comment:The only thing missing is RSS, which can be added to comment-authors Link:In the context of FSE none of these will be needed... They can be helpers when building more complex PHP code, but on their own they don't mean anything. The only thing that could possibly be added is an "edit-post" link-block As mentioned by @kjellr: "Most of the “Link” entries could probably just be dynamic links for use in block-based themes. A few might be worth including in the UI for the user to access, but many won’t." As mentioned by @poena: the post comment link is still used fairly often Post:If the post-content block outputs the correct markup with the right ID, using post_class and all the things that dozens of plugins use, we should be OK. One of the things that troubles us is |
Cross-referencing comment from #24762 (comment):
@mtias, it's already listed here as Query Title block and it is distinct from Post Title. |
@gziolo by "Page Title" I meant https://developer.wordpress.org/reference/functions/the_archive_title/ |
The following template tags are used by Twenty Twenty-One, so they would be useful to get in place for TT1 Blocks
These two are also used but I guess they aren't relevant:
|
@pbking @MaggieCabrera @jffng and I went through these and this was what we came up with:
Next Post / Prev Post BlocksWe need a way to add page titles to these blocks. Featured Image BlockFeatured images can have captions in Twenty Twenty-One, so I think we should add this to the block. Search Template
Missing TemplatesThere are a few templates that don't seem to be customizable in the Site Editor:
We couldn't find a way to do this in the Site Editor. Post FormatsThere are custom excerpts for all post formats. Aside and status post formats also get a different treatment in the index template. There's no way (to our knowledge) to achieve this in the Site Editor. This raises the question of whether we want to continue supporting Post Formats going forward.
|
No need to add anything to show posts by that user. Author-posts pages are archives, so if a theme has an
Agreed. There's already an edit-post link in the adminbar when users view an individual post.
+1 |
The block already lets you add a page title as an option, but it needs some improvement: you can't add a line break between label and post title and you can't make the label a link to the next/prev post if you have the title also showing up. I opened an issue about this here |
I couldn't find a way to add this link to the author bio though - unless I'm missing it? |
Ah you're right, my bad. I misread the previous post... Yes, we'll need to add a link to their posts somewhere 👍 |
Can you clarify what you mean by this?
I think captions on featured images is a bit odd / niche.
This is more a case of being able to edit the Query "no results" state in my mind.
I hope we can improve upon the dynamics of some of these instead of just copying what we currently do. Attachment templates in particular I think need a bit of a rethink.
Are these cosmetic or structural changes?
Let's have an issue for this. Also for post_class. |
@MaggieCabrera opened an issue for this here: #29032 |
The difference is that some excerpts show all the content, and others just show the first block from the post using |
Done here: #29308 |
There are a few things to consider here since we are talking about variations of the template used to show a post loop based on characteristics of a given post. Possibly, some aspects could be absorbed in the blocks themselves with good defaults. For example, the excerpt block, content block, or post title block could have different default displays based on what post format is provided. This has the advantage of being simpler but is also opaque to the user and the theme template. To allow full customization over things like "set a different font size for the excerpt if it comes from an aside", or "hide the title" it's either going to be through the cascade or by allowing template variations for the post loop. The UI for the latter can get very intricate but it can be worth exploring. Right now, for example, the template is implicit in the layout of the loop which is great for most common cases. But it can also make sense to have a more focused view, like an "edit template" button in the post loop toolbar opening a modal where you only focus on a single post at a time, and which could have some contextual filters for "format", "category", etc. How we store these within the post-loop block also needs some thinking. :) |
Could another option use template parts? We have Header and Footer |
In the spirit of "covering all features of template tags in … FSE" I was taking a look at "title" blocks today and wanted to highlight a couple items … Post Title Block, Site Title Block
High-impact here means to me, "Could really boost themes, template part patterns, and query patterns, for end-users, themers, and patternmakers." (It's not a template-tag issue but Group Block: Add a ‘display horizontal’ option may do that as well in concert with the above settings.) |
You are right that it can be re-purposed in many ways that will be tricky to cover, but #29173 covers one particular purpose of it. |
There is only one single block that is marked as completed. How do we know what is needed for a block to be considered complete, and are completed blocks no longer experimental? |
I'm going to do a review, but I think this issue probably exhausted its usefulness now. We have blocks that are ready (like site logo) but still need several improvements, which we should track on a specific site logo issue. As part of #28744 we should be deciding which ones are ready. |
Yes, it's very hard to define "completed" since the scope isn't clear - we're not just copying the functionality from the old template tags. It might be useful to have overview issues for every core block though? |
Covering All Features of Template Tags in Full Site Editing (FSE)
What are template tags?
Template tags are PHP functions used in traditional WordPress template files to display content from the database dynamically. For example, the
the_author()
tag prints the name of the current author. They are grouped by their "category," which is a loose mapping to the entity they refer to.Some template tags are also compositions of a set of template tags.
How this relates to FSE.
We need to make sure that we have all the necessary blocks in place to accomplish everything possible in traditional templates using template tags. This issue aims to track our progress towards this goal and to surface areas where we lack functionality and require contributions.
Tracking Tables
Below we track all template tags alongside their block equivalent, if we need one (N/A otherwise), whether the development has started, and whether the current state of development matches or exceeds all the functionality provided by the tag.
Note that this list is just an educated guess. The idea is for everyone in the community, especially those very familiar with traditional theme development, to contribute to this list. There might be things we are missing. There might be things we could lose.
Also, note that some of these blocks could be split up into different blocks if the scope of their functionality creeps too much or people see a benefit in having more fine-grained control. For example, the Post Comments block could use a mechanism like the Query Loop block's to build a template for comments using Comment Author, Comment Date, and Comment Content blocks.
Template Tags Reference: https://codex.wordpress.org/Template_Tags
General
get_header()
get_footer()
get_sidebar()
get_template_part()
get_search_form()
wp_loginout()
wp_logout_url()
wp_login_url()
wp_login_form()
wp_lostpassword_url()
wp_register()
wp_meta()
bloginfo()
get_bloginfo()
get_current_blog_id()
wp_title()
single_post_title()
post_type_archive_title()
single_cat_title()
single_tag_title()
single_term_title()
single_month_title()
get_archives_link()
wp_get_archives()
calendar_week_mod()
get_calendar()
delete_get_calendar_cache()
allowed_tags()
wp_ajaxurl()
wp_enqueue_script()
Author
the_author()
get_the_author()
the_author_link()
get_the_author_link()
the_author_meta()
the_author_posts()
the_author_posts_link()
wp_dropdown_users()
wp_list_authors()
get_author_posts_url()
Bookmark
wp_list_bookmarks()
get_bookmark()
get_bookmark_field()
get_bookmarks()
Category
category_description()
the_category()
the_category_rss()
wp_dropdown_categories()
wp_list_categories()
tag_description()
the_tags()
wp_generate_tag_cloud()
wp_tag_cloud()
term_description()
get_the_term_list()
the_terms()
the_taxonomies()
Comment
cancel_comment_reply_link()
comment_author_email()
comment_author_email_link()
comment_author()
comment_author_IP()
comment_author_link()
comment_author_rss()
comment_author_url()
comment_author_url_link()
comment_class()
comment_date()
comment_excerpt()
comment_form_title()
comment_form()
comment_ID()
comment_id_fields()
comment_reply_link()
comment_text()
comment_text_rss()
comment_time()
comment_type()
comments_link()
comments_number()
comments_popup_link()
comments_popup_script()
comments_rss_link()
get_avatar()
next_comments_link()
paginate_comments_links()
permalink_comments_rss()
previous_comments_link()
wp_list_comments()
Link
the_permalink()
user_trailingslashit()
permalink_anchor()
get_permalink()
get_post_permalink()
post_permalink()
get_page_link()
get_attachment_link()
wp_shortlink_header()
wp_shortlink_wp_head()
edit_bookmark_link()
edit_comment_link()
edit_post_link()
get_edit_post_link()
get_delete_post_link()
edit_tag_link()
get_admin_url()
get_home_url()
get_site_url()
home_url()
site_url()
get_search_link()
get_search_query()
the_feed_link()
Post
body_class()
next_image_link()
next_post_link()
next_posts_link()
post_class()
post_password_required()
posts_nav_link()
previous_image_link()
previous_post_link()
previous_posts_link()
sticky_class()
the_content()
the_content_rss()
the_excerpt()
the_excerpt_rss()
the_ID()
the_meta()
the_title()
get_the_title()
the_title_attribute()
the_title_rss()
wp_link_pages()
get_attachment_link()
wp_get_attachment_link()
the_attachment_link()
the_search_query()
is_attachment()
wp_attachment_is_image()
wp_get_attachment_image()
wp_get_attachment_image_src()
wp_get_attachment_metadata()
get_the_date()
the_date()
the_date_xml()
the_modified_author()
the_modified_date()
the_modified_time()
the_time()
the_shortlink()
wp_get_shortlink()
Post Thumbnail
has_post_thumbnail()
get_post_thumbnail_id()
the_post_thumbnail()
get_the_post_thumbnail()
Navigation Menu
wp_nav_menu()
walk_nav_menu_tree()
The text was updated successfully, but these errors were encountered: