-
-
Notifications
You must be signed in to change notification settings - Fork 107
Add more filters and create actions #841
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Closed
Upstream main
Upstream main
Merge main into add-more-filters
ARIA role="search" added in HTML
Update searchform.php for accessibility
Upstream main
Upstream main
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds numerous filters and introduces actions. All changes are additions and do not affect overridden template files in the child theme.
Motivation & context
I'm currently working on two themes that I want to deeply customize without overriding any template files. Everything is achieved using filters/actions and a bit of additional CSS/JS.
Both themes are a work in progress but demonstrate how these filters and actions can be used and have the same sample content. Pay special attention to:
Header
There is an additional static header that changes when scrolling. The Fashion theme includes an extra scrolling menu, and the main menu is placed inside the burger button on all screen sizes. All button and widget positions have been adjusted, and Fashion has a dedicated mobile logo.
Breadcrumb
The default and WC breadcrumbs are now unified instead of having two (similar-looking) separate ones. Both use the same filters.
breadcrumb.phpfile to the theme to add the filter, but I’m fine with maintaining this file.::beforemask-image. The icon has a filter that allows you to change it in both breadcrumbs with a single function.*-blank.phptemplates) and archives via an action hook. Check the custom breadcrumb on posts, pages, WC pages, archives, and search results. They are still different breadcrumbs but are modified by filters shared across the breadcrumb files.Loop
The index, archive, and search results now have filters and actions that allow you to fully customize the loop. You can modify the cards, adjust the columns, add more meta information, or remove existing meta. You can also change font-size classes or create vertical cards. Everything is possible (see the example snippets).
The author archive now includes the Gravatar, added via an action.
Icons
These themes have Font Awesome disabled and use Bootstrap Icons or Boxicons instead. Each icon can be modified with a filter. Add an item to the cart to see the icons in the offcanvas cart.
Content
Posts include additional meta information and the updated date above the tags.
Sidebar
The sidebar title and icon are different on WC pages.
I’ve already implemented this on a customer’s live site, https://song-ev.de, where these hooks are used to create a secondary burger menu next to the navbar, as well as the triangle above the footer and below the header (not on the front page).
Filters
Filter list (including existing ones)
bootscore/class/headerbootscore/class/header/navbar/breakpointbootscore/class/container($location)bootscore/class/header/navbar-brandbootscore/logobootscore/class/header/offcanvas/direction($location)bootscore/class/offcanvas/header($location)bootscore/offcanvas/navbar/titlebootscore/class/offcanvas/body($location)bootscore/class/header-actionsbootscore/class/header/button($location)bootscore/class/header/navbar/toggler/breakpointbootscore/class/header/action/spacer($location)bootscore/class/header/top-nav-widget-2bootscore/class/header/search/breakpointbootscore/class/header/navbar-navbootscore/offcanvas/account/titlebootscore/offcanvas/cart/titlebootscore/class/cart/product-titlebootscore/class/cart/enable_cart_product_excerpt(true)bootscore/class/cart/product-excerptbootscore/class/cart/enable_cart_stock_quantity(true)bootscore/class/header/cart/footerbootscore/class/breadcrumb/navbootscore/class/breadcrumb/olbootscore/class/breadcrumb/item/linkbootscore/class/main/colbootscore/class/entry/title($location)bootscore/class/content/spacer($location)bootscore/class/featured-full-width-img($location)bootscore/class/full-width-img-title-wrapper($location)bootscore/class/loop/card($location)bootscore/class/loop/card/row($location)bootscore/class/loop/card/image/col($location)bootscore/class/loop/card/image($location)bootscore/class/loop/card/content/col($location)bootscore/class/loop/card/body($location)bootscore/loop/category(true, $location)bootscore/class/loop/card/title($location)bootscore/loop/meta(true, $location)bootscore/loop/excerpt(true, $location)bootscore/class/loop/card-text/excerpt($location)bootscore/loop/read-more(true, $location)bootscore/class/loop/card-text/read-more($location)bootscore/class/loop/read-more($location)bootscore/loop/read-more/text($location)`bootscore/loop/tags(true, $location)bootscore/class/sidebar/colbootscore/class/sidebar/buttonbootscore/offcanvas/sidebar/button/textbootscore/class/sidebar/offcanvasbootscore/offcanvas/sidebar/titlebootscore/block/archives/contentbootscore/block/calendar/contentbootscore/block/categories/contentbootscore/block/latest-comments/contentbootscore/block/latest-posts/contentbootscore/class/widget/search/button($location)bootscore/block/search/contentbootscore/icon/menubootscore/icon/search($location)bootscore/icon/userbootscore/icon/arrow-leftbootscore/icon/cartbootscore/icon/trashbootscore/icon/chevron-upbootscore/icon/homebootscore/icon/commentsbootscore/class/comment/avatarbootscore/class/badge/categorybootscore/meta/time/updatedbootscore/meta/authorbootscore/class/badge/tagbootscore/class/footer/topbootscore/class/footer/columnsbootscore/class/footer/col($location)bootscore/class/footer/col/spacer($location)bootscore/class/footer/infobootscore/class/footer/to_top_buttonbootscore/load_fontawesome(true)bootscore/skip_cart(false)bootscore/load_ajax_cart (true)bootscore/scss/skip_environment_check(false)bootscore/scss/disable_compiler(false)bootscore/scss/compilerActions
Snippet to hook into all actions
This snippet generates an alert-warning for each action to make them visible:
Action list and visual map
Header
bootscore_before_mastheadbootscore_after_masthead_openbootscore_before_navbar_brandbootscore_after_nav_togglerbootscore_before_masthead_closebootscore_after_mastheadLoop, content & sidebar
Index
Archive
Search
Page
Page full
Single
Single full
bootscore_after_primary_open($location)bootscore_before_title($location)bootscore_after_title($location)bootscore_before_loop($location)bootscore_before_loop_item($location)bootscore_before_loop_title($location)bootscore_loop_item_after_card_body($location)bootscore_after_loop_item($location)bootscore_after_loop($location)bootscore_after_featured_image($location)bootscore_before_entry_footer($location)bootscore_before_sidebar_widgetsbootscore_after_sidebar_widgetsFooter
bootscore_before_footerbootscore_footer_columns_before_containerbootscore_footer_columns_after_container_openbootscore_footer_columns_before_container_closebootscore_footer_columns_after_containerbootscore_footer_info_after_container_openExamples
Here are some rough examples how powerful this filters and actions work together:
Change all icons
Add a mobile logo, center the logo and move menu to left
Search collapse always collapsed (if WC is not installed)
Breadcrumb
Change all loop horizontal cards into vertical cards and change read-more
cc @hsankala