From 2c86378f1b16f41d6ed3dd1838f6672c3086e516 Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Tue, 7 Mar 2023 06:11:35 +0100 Subject: [PATCH 01/17] Add 3 options to the post navigation link --- docs/reference-guides/core-blocks.md | 839 +++++++++--------- .../src/post-navigation-link/block.json | 10 + .../src/post-navigation-link/edit.js | 55 +- .../src/post-navigation-link/index.php | 6 +- 4 files changed, 488 insertions(+), 422 deletions(-) diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index a4e307c94df87e..e0651057383a9d 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -2,10 +2,9 @@ This page lists the blocks included in the block-library package. -- Items marked with a strikeout (~~strikeout~~) are explicitly disabled. -- Blocks marked with **Experimental:** true are only available when Gutenberg is active. -- Blocks marked with **Experimental:** fse are only available in the Site Editor. - +- Items marked with a strikeout (~~strikeout~~) are explicitly disabled. +- Blocks marked with **Experimental:** true are only available when Gutenberg is active. +- Blocks marked with **Experimental:** fse are only available in the Site Editor. @@ -13,900 +12,900 @@ This page lists the blocks included in the block-library package. Display a date archive of your posts. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/archives)) -- **Name:** core/archives -- **Category:** widgets -- **Supports:** align, spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** displayAsDropdown, showLabel, showPostCounts, type +- **Name:** core/archives +- **Category:** widgets +- **Supports:** align, spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** displayAsDropdown, showLabel, showPostCounts, type ## Audio Embed a simple audio player. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/audio)) -- **Name:** core/audio -- **Category:** media -- **Supports:** align, anchor, spacing (margin, padding) -- **Attributes:** autoplay, caption, id, loop, preload, src +- **Name:** core/audio +- **Category:** media +- **Supports:** align, anchor, spacing (margin, padding) +- **Attributes:** autoplay, caption, id, loop, preload, src ## Avatar Add a user’s avatar. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/avatar)) -- **Name:** core/avatar -- **Category:** theme -- **Supports:** align, color (~~background~~, ~~text~~), spacing (margin, padding), ~~alignWide~~, ~~html~~ -- **Attributes:** isLink, linkTarget, size, userId +- **Name:** core/avatar +- **Category:** theme +- **Supports:** align, color (~~background~~, ~~text~~), spacing (margin, padding), ~~alignWide~~, ~~html~~ +- **Attributes:** isLink, linkTarget, size, userId ## Pattern Create and save content to reuse across your site. Update the block, and the changes apply everywhere it’s used. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/block)) -- **Name:** core/block -- **Category:** reusable -- **Supports:** ~~customClassName~~, ~~html~~, ~~inserter~~ -- **Attributes:** ref +- **Name:** core/block +- **Category:** reusable +- **Supports:** ~~customClassName~~, ~~html~~, ~~inserter~~ +- **Attributes:** ref ## Button Prompt visitors to take action with a button-style link. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/button)) -- **Name:** core/button -- **Category:** design -- **Parent:** core/buttons -- **Supports:** anchor, color (background, gradients, text), shadow, spacing (padding), typography (fontSize, lineHeight), ~~alignWide~~, ~~align~~, ~~reusable~~ -- **Attributes:** backgroundColor, gradient, linkTarget, placeholder, rel, text, textAlign, textColor, title, url, width +- **Name:** core/button +- **Category:** design +- **Parent:** core/buttons +- **Supports:** anchor, color (background, gradients, text), shadow, spacing (padding), typography (fontSize, lineHeight), ~~alignWide~~, ~~align~~, ~~reusable~~ +- **Attributes:** backgroundColor, gradient, linkTarget, placeholder, rel, text, textAlign, textColor, title, url, width ## Buttons Prompt visitors to take action with a group of button-style links. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/buttons)) -- **Name:** core/buttons -- **Category:** design -- **Supports:** align (full, wide), anchor, layout (default, ~~allowInheriting~~, ~~allowSwitching~~), spacing (blockGap, margin), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** +- **Name:** core/buttons +- **Category:** design +- **Supports:** align (full, wide), anchor, layout (default, ~~allowInheriting~~, ~~allowSwitching~~), spacing (blockGap, margin), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** ## Calendar A calendar of your site’s posts. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/calendar)) -- **Name:** core/calendar -- **Category:** widgets -- **Supports:** align, color (background, link, text), typography (fontSize, lineHeight) -- **Attributes:** month, year +- **Name:** core/calendar +- **Category:** widgets +- **Supports:** align, color (background, link, text), typography (fontSize, lineHeight) +- **Attributes:** month, year ## Categories List Display a list of all categories. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/categories)) -- **Name:** core/categories -- **Category:** widgets -- **Supports:** align, spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** displayAsDropdown, showEmpty, showHierarchy, showOnlyTopLevel, showPostCounts +- **Name:** core/categories +- **Category:** widgets +- **Supports:** align, spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** displayAsDropdown, showEmpty, showHierarchy, showOnlyTopLevel, showPostCounts ## Code Display code snippets that respect your spacing and tabs. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/code)) -- **Name:** core/code -- **Category:** text -- **Supports:** align (wide), anchor, color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight) -- **Attributes:** content +- **Name:** core/code +- **Category:** text +- **Supports:** align (wide), anchor, color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight) +- **Attributes:** content ## Column A single column within a columns block. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/column)) -- **Name:** core/column -- **Category:** design -- **Parent:** core/columns -- **Supports:** anchor, color (background, gradients, heading, link, text), layout, spacing (blockGap, padding), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** allowedBlocks, templateLock, verticalAlignment, width +- **Name:** core/column +- **Category:** design +- **Parent:** core/columns +- **Supports:** anchor, color (background, gradients, heading, link, text), layout, spacing (blockGap, padding), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** allowedBlocks, templateLock, verticalAlignment, width ## Columns Display content in multiple columns, with blocks added to each column. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/columns)) -- **Name:** core/columns -- **Category:** design -- **Supports:** align (full, wide), anchor, color (background, gradients, link, text), layout (default, ~~allowEditing~~, ~~allowInheriting~~, ~~allowSwitching~~), spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** isStackedOnMobile, templateLock, verticalAlignment +- **Name:** core/columns +- **Category:** design +- **Supports:** align (full, wide), anchor, color (background, gradients, link, text), layout (default, ~~allowEditing~~, ~~allowInheriting~~, ~~allowSwitching~~), spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** isStackedOnMobile, templateLock, verticalAlignment ## Comment Author Avatar (deprecated) This block is deprecated. Please use the Avatar block instead. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comment-author-avatar)) -- **Name:** core/comment-author-avatar -- **Experimental:** fse -- **Category:** theme -- **Supports:** color (background, ~~text~~), spacing (margin, padding), ~~html~~, ~~inserter~~ -- **Attributes:** height, width +- **Name:** core/comment-author-avatar +- **Experimental:** fse +- **Category:** theme +- **Supports:** color (background, ~~text~~), spacing (margin, padding), ~~html~~, ~~inserter~~ +- **Attributes:** height, width ## Comment Author Name Displays the name of the author of the comment. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comment-author-name)) -- **Name:** core/comment-author-name -- **Category:** theme -- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** isLink, linkTarget, textAlign +- **Name:** core/comment-author-name +- **Category:** theme +- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** isLink, linkTarget, textAlign ## Comment Content Displays the contents of a comment. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comment-content)) -- **Name:** core/comment-content -- **Category:** theme -- **Supports:** color (background, gradients, link, text), spacing (padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** textAlign +- **Name:** core/comment-content +- **Category:** theme +- **Supports:** color (background, gradients, link, text), spacing (padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** textAlign ## Comment Date Displays the date on which the comment was posted. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comment-date)) -- **Name:** core/comment-date -- **Category:** theme -- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** format, isLink +- **Name:** core/comment-date +- **Category:** theme +- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** format, isLink ## Comment Edit Link Displays a link to edit the comment in the WordPress Dashboard. This link is only visible to users with the edit comment capability. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comment-edit-link)) -- **Name:** core/comment-edit-link -- **Category:** theme -- **Supports:** color (background, gradients, link, ~~text~~), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** linkTarget, textAlign +- **Name:** core/comment-edit-link +- **Category:** theme +- **Supports:** color (background, gradients, link, ~~text~~), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** linkTarget, textAlign ## Comment Reply Link Displays a link to reply to a comment. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comment-reply-link)) -- **Name:** core/comment-reply-link -- **Category:** theme -- **Supports:** color (background, gradients, link, ~~text~~), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** textAlign +- **Name:** core/comment-reply-link +- **Category:** theme +- **Supports:** color (background, gradients, link, ~~text~~), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** textAlign ## Comment Template Contains the block elements used to display a comment, like the title, date, author, avatar and more. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comment-template)) -- **Name:** core/comment-template -- **Category:** design -- **Parent:** core/comments -- **Supports:** align, spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** +- **Name:** core/comment-template +- **Category:** design +- **Parent:** core/comments +- **Supports:** align, spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** ## Comments An advanced block that allows displaying post comments using different visual configurations. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comments)) -- **Name:** core/comments -- **Category:** theme -- **Supports:** align (full, wide), color (background, gradients, heading, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** legacy, tagName +- **Name:** core/comments +- **Category:** theme +- **Supports:** align (full, wide), color (background, gradients, heading, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** legacy, tagName ## Comments Pagination Displays a paginated navigation to next/previous set of comments, when applicable. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comments-pagination)) -- **Name:** core/comments-pagination -- **Category:** theme -- **Parent:** core/comments -- **Supports:** align, color (background, gradients, link, text), layout (default, ~~allowInheriting~~, ~~allowSwitching~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** paginationArrow +- **Name:** core/comments-pagination +- **Category:** theme +- **Parent:** core/comments +- **Supports:** align, color (background, gradients, link, text), layout (default, ~~allowInheriting~~, ~~allowSwitching~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** paginationArrow ## Comments Next Page Displays the next comment's page link. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comments-pagination-next)) -- **Name:** core/comments-pagination-next -- **Category:** theme -- **Parent:** core/comments-pagination -- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** label +- **Name:** core/comments-pagination-next +- **Category:** theme +- **Parent:** core/comments-pagination +- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** label ## Comments Page Numbers Displays a list of page numbers for comments pagination. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comments-pagination-numbers)) -- **Name:** core/comments-pagination-numbers -- **Category:** theme -- **Parent:** core/comments-pagination -- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** +- **Name:** core/comments-pagination-numbers +- **Category:** theme +- **Parent:** core/comments-pagination +- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** ## Comments Previous Page Displays the previous comment's page link. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comments-pagination-previous)) -- **Name:** core/comments-pagination-previous -- **Category:** theme -- **Parent:** core/comments-pagination -- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** label +- **Name:** core/comments-pagination-previous +- **Category:** theme +- **Parent:** core/comments-pagination +- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** label ## Comments Title Displays a title with the number of comments ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comments-title)) -- **Name:** core/comments-title -- **Category:** theme -- **Supports:** align, color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~anchor~~, ~~html~~ -- **Attributes:** level, showCommentsCount, showPostTitle, textAlign +- **Name:** core/comments-title +- **Category:** theme +- **Supports:** align, color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~anchor~~, ~~html~~ +- **Attributes:** level, showCommentsCount, showPostTitle, textAlign ## Cover Add an image or video with a text overlay. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/cover)) -- **Name:** core/cover -- **Category:** media -- **Supports:** align, anchor, color (heading, text, ~~background~~), layout (~~allowJustification~~), spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** allowedBlocks, alt, backgroundType, contentPosition, customGradient, customOverlayColor, dimRatio, focalPoint, gradient, hasParallax, id, isDark, isRepeated, minHeight, minHeightUnit, overlayColor, tagName, templateLock, url, useFeaturedImage +- **Name:** core/cover +- **Category:** media +- **Supports:** align, anchor, color (heading, text, ~~background~~), layout (~~allowJustification~~), spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** allowedBlocks, alt, backgroundType, contentPosition, customGradient, customOverlayColor, dimRatio, focalPoint, gradient, hasParallax, id, isDark, isRepeated, minHeight, minHeightUnit, overlayColor, tagName, templateLock, url, useFeaturedImage ## Details Hide and show additional content. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/details)) -- **Name:** core/details -- **Category:** text -- **Supports:** align (full, wide), color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** showContent, summary +- **Name:** core/details +- **Category:** text +- **Supports:** align (full, wide), color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** showContent, summary ## Embed Add a block that displays content pulled from other sites, like Twitter or YouTube. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/embed)) -- **Name:** core/embed -- **Category:** embed -- **Supports:** align, spacing (margin) -- **Attributes:** allowResponsive, caption, previewable, providerNameSlug, responsive, type, url +- **Name:** core/embed +- **Category:** embed +- **Supports:** align, spacing (margin) +- **Attributes:** allowResponsive, caption, previewable, providerNameSlug, responsive, type, url ## File Add a link to a downloadable file. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/file)) -- **Name:** core/file -- **Category:** media -- **Supports:** align, anchor, color (background, gradients, link, ~~text~~), interactivity -- **Attributes:** displayPreview, downloadButtonText, fileId, fileName, href, id, previewHeight, showDownloadButton, textLinkHref, textLinkTarget +- **Name:** core/file +- **Category:** media +- **Supports:** align, anchor, color (background, gradients, link, ~~text~~), interactivity +- **Attributes:** displayPreview, downloadButtonText, fileId, fileName, href, id, previewHeight, showDownloadButton, textLinkHref, textLinkTarget ## Footnotes - ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/footnotes)) +([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/footnotes)) -- **Name:** core/footnotes -- **Category:** text -- **Supports:** ~~html~~, ~~inserter~~, ~~multiple~~, ~~reusable~~ -- **Attributes:** +- **Name:** core/footnotes +- **Category:** text +- **Supports:** ~~html~~, ~~inserter~~, ~~multiple~~, ~~reusable~~ +- **Attributes:** ## Classic Use the classic WordPress editor. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/freeform)) -- **Name:** core/freeform -- **Category:** text -- **Supports:** ~~className~~, ~~customClassName~~, ~~reusable~~ -- **Attributes:** content +- **Name:** core/freeform +- **Category:** text +- **Supports:** ~~className~~, ~~customClassName~~, ~~reusable~~ +- **Attributes:** content ## Gallery Display multiple images in a rich gallery. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/gallery)) -- **Name:** core/gallery -- **Category:** media -- **Supports:** align, anchor, color (background, gradients, ~~text~~), layout (default, ~~allowEditing~~, ~~allowInheriting~~, ~~allowSwitching~~), spacing (blockGap, margin, padding), units (em, px, rem, vh, vw), ~~html~~ -- **Attributes:** allowResize, caption, columns, fixedHeight, ids, imageCrop, images, linkTarget, linkTo, shortCodeTransforms, sizeSlug +- **Name:** core/gallery +- **Category:** media +- **Supports:** align, anchor, color (background, gradients, ~~text~~), layout (default, ~~allowEditing~~, ~~allowInheriting~~, ~~allowSwitching~~), spacing (blockGap, margin, padding), units (em, px, rem, vh, vw), ~~html~~ +- **Attributes:** allowResize, caption, columns, fixedHeight, ids, imageCrop, images, linkTarget, linkTo, shortCodeTransforms, sizeSlug ## Group Gather blocks in a layout container. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/group)) -- **Name:** core/group -- **Category:** design -- **Supports:** align (full, wide), anchor, ariaLabel, color (background, gradients, heading, link, text), dimensions (minHeight), layout (allowSizingOnChildren), position (sticky), spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** allowedBlocks, tagName, templateLock +- **Name:** core/group +- **Category:** design +- **Supports:** align (full, wide), anchor, ariaLabel, color (background, gradients, heading, link, text), dimensions (minHeight), layout (allowSizingOnChildren), position (sticky), spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** allowedBlocks, tagName, templateLock ## Heading Introduce new sections and organize content to help visitors (and search engines) understand the structure of your content. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/heading)) -- **Name:** core/heading -- **Category:** text -- **Supports:** __unstablePasteTextInline, align (full, wide), anchor, className, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight) -- **Attributes:** content, level, placeholder, textAlign +- **Name:** core/heading +- **Category:** text +- **Supports:** \_\_unstablePasteTextInline, align (full, wide), anchor, className, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight) +- **Attributes:** content, level, placeholder, textAlign ## Home Link Create a link that always points to the homepage of the site. Usually not necessary if there is already a site title link present in the header. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/home-link)) -- **Name:** core/home-link -- **Category:** design -- **Parent:** core/navigation -- **Supports:** typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** label +- **Name:** core/home-link +- **Category:** design +- **Parent:** core/navigation +- **Supports:** typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** label ## Custom HTML Add custom HTML code and preview it as you edit. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/html)) -- **Name:** core/html -- **Category:** widgets -- **Supports:** ~~className~~, ~~customClassName~~, ~~html~~ -- **Attributes:** content +- **Name:** core/html +- **Category:** widgets +- **Supports:** ~~className~~, ~~customClassName~~, ~~html~~ +- **Attributes:** content ## Image Insert an image to make a visual statement. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/image)) -- **Name:** core/image -- **Category:** media -- **Supports:** anchor, behaviors (lightbox), color (~~background~~, ~~text~~), filter (duotone) -- **Attributes:** align, alt, aspectRatio, caption, height, href, id, linkClass, linkDestination, linkTarget, rel, scale, sizeSlug, title, url, width +- **Name:** core/image +- **Category:** media +- **Supports:** anchor, behaviors (lightbox), color (~~background~~, ~~text~~), filter (duotone) +- **Attributes:** align, alt, aspectRatio, caption, height, href, id, linkClass, linkDestination, linkTarget, rel, scale, sizeSlug, title, url, width ## Latest Comments Display a list of your most recent comments. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/latest-comments)) -- **Name:** core/latest-comments -- **Category:** widgets -- **Supports:** align, spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** commentsToShow, displayAvatar, displayDate, displayExcerpt +- **Name:** core/latest-comments +- **Category:** widgets +- **Supports:** align, spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** commentsToShow, displayAvatar, displayDate, displayExcerpt ## Latest Posts Display a list of your most recent posts. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/latest-posts)) -- **Name:** core/latest-posts -- **Category:** widgets -- **Supports:** align, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** addLinkToFeaturedImage, categories, columns, displayAuthor, displayFeaturedImage, displayPostContent, displayPostContentRadio, displayPostDate, excerptLength, featuredImageAlign, featuredImageSizeHeight, featuredImageSizeSlug, featuredImageSizeWidth, order, orderBy, postLayout, postsToShow, selectedAuthor +- **Name:** core/latest-posts +- **Category:** widgets +- **Supports:** align, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** addLinkToFeaturedImage, categories, columns, displayAuthor, displayFeaturedImage, displayPostContent, displayPostContentRadio, displayPostDate, excerptLength, featuredImageAlign, featuredImageSizeHeight, featuredImageSizeSlug, featuredImageSizeWidth, order, orderBy, postLayout, postsToShow, selectedAuthor ## List Create a bulleted or numbered list. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/list)) -- **Name:** core/list -- **Category:** text -- **Supports:** __unstablePasteTextInline, anchor, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~className~~ -- **Attributes:** ordered, placeholder, reversed, start, type, values +- **Name:** core/list +- **Category:** text +- **Supports:** \_\_unstablePasteTextInline, anchor, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~className~~ +- **Attributes:** ordered, placeholder, reversed, start, type, values ## List item Create a list item. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/list-item)) -- **Name:** core/list-item -- **Category:** text -- **Parent:** core/list -- **Supports:** typography (fontSize, lineHeight), ~~className~~ -- **Attributes:** content, placeholder +- **Name:** core/list-item +- **Category:** text +- **Parent:** core/list +- **Supports:** typography (fontSize, lineHeight), ~~className~~ +- **Attributes:** content, placeholder ## Login/out Show login & logout links. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/loginout)) -- **Name:** core/loginout -- **Category:** theme -- **Supports:** className, typography (fontSize, lineHeight) -- **Attributes:** displayLoginAsForm, redirectToCurrent +- **Name:** core/loginout +- **Category:** theme +- **Supports:** className, typography (fontSize, lineHeight) +- **Attributes:** displayLoginAsForm, redirectToCurrent ## Media & Text Set media and words side-by-side for a richer layout. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/media-text)) -- **Name:** core/media-text -- **Category:** media -- **Supports:** align (full, wide), anchor, color (background, gradients, heading, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** align, allowedBlocks, focalPoint, href, imageFill, isStackedOnMobile, linkClass, linkDestination, linkTarget, mediaAlt, mediaId, mediaLink, mediaPosition, mediaSizeSlug, mediaType, mediaUrl, mediaWidth, rel, verticalAlignment +- **Name:** core/media-text +- **Category:** media +- **Supports:** align (full, wide), anchor, color (background, gradients, heading, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** align, allowedBlocks, focalPoint, href, imageFill, isStackedOnMobile, linkClass, linkDestination, linkTarget, mediaAlt, mediaId, mediaLink, mediaPosition, mediaSizeSlug, mediaType, mediaUrl, mediaWidth, rel, verticalAlignment ## Unsupported Your site doesn’t include support for this block. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/missing)) -- **Name:** core/missing -- **Category:** text -- **Supports:** ~~className~~, ~~customClassName~~, ~~html~~, ~~inserter~~, ~~reusable~~ -- **Attributes:** originalContent, originalName, originalUndelimitedContent +- **Name:** core/missing +- **Category:** text +- **Supports:** ~~className~~, ~~customClassName~~, ~~html~~, ~~inserter~~, ~~reusable~~ +- **Attributes:** originalContent, originalName, originalUndelimitedContent ## More Content before this block will be shown in the excerpt on your archives page. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/more)) -- **Name:** core/more -- **Category:** design -- **Supports:** ~~className~~, ~~customClassName~~, ~~html~~, ~~multiple~~ -- **Attributes:** customText, noTeaser +- **Name:** core/more +- **Category:** design +- **Supports:** ~~className~~, ~~customClassName~~, ~~html~~, ~~multiple~~ +- **Attributes:** customText, noTeaser ## Navigation A collection of blocks that allow visitors to get around your site. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/navigation)) -- **Name:** core/navigation -- **Category:** theme -- **Supports:** align (full, wide), inserter, interactivity, layout (allowSizingOnChildren, default, ~~allowInheriting~~, ~~allowSwitching~~, ~~allowVerticalAlignment~~), spacing (blockGap, units), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** __unstableLocation, backgroundColor, customBackgroundColor, customOverlayBackgroundColor, customOverlayTextColor, customTextColor, hasIcon, icon, maxNestingLevel, openSubmenusOnClick, overlayBackgroundColor, overlayMenu, overlayTextColor, ref, rgbBackgroundColor, rgbTextColor, showSubmenuIcon, templateLock, textColor +- **Name:** core/navigation +- **Category:** theme +- **Supports:** align (full, wide), inserter, interactivity, layout (allowSizingOnChildren, default, ~~allowInheriting~~, ~~allowSwitching~~, ~~allowVerticalAlignment~~), spacing (blockGap, units), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** \_\_unstableLocation, backgroundColor, customBackgroundColor, customOverlayBackgroundColor, customOverlayTextColor, customTextColor, hasIcon, icon, maxNestingLevel, openSubmenusOnClick, overlayBackgroundColor, overlayMenu, overlayTextColor, ref, rgbBackgroundColor, rgbTextColor, showSubmenuIcon, templateLock, textColor ## Custom Link Add a page, link, or another item to your navigation. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/navigation-link)) -- **Name:** core/navigation-link -- **Category:** design -- **Parent:** core/navigation -- **Supports:** typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** description, id, isTopLevelLink, kind, label, opensInNewTab, rel, title, type, url +- **Name:** core/navigation-link +- **Category:** design +- **Parent:** core/navigation +- **Supports:** typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** description, id, isTopLevelLink, kind, label, opensInNewTab, rel, title, type, url ## Submenu Add a submenu to your navigation. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/navigation-submenu)) -- **Name:** core/navigation-submenu -- **Category:** design -- **Parent:** core/navigation -- **Supports:** ~~html~~, ~~reusable~~ -- **Attributes:** description, id, isTopLevelItem, kind, label, opensInNewTab, rel, title, type, url +- **Name:** core/navigation-submenu +- **Category:** design +- **Parent:** core/navigation +- **Supports:** ~~html~~, ~~reusable~~ +- **Attributes:** description, id, isTopLevelItem, kind, label, opensInNewTab, rel, title, type, url ## Page Break Separate your content into a multi-page experience. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/nextpage)) -- **Name:** core/nextpage -- **Category:** design -- **Parent:** core/post-content -- **Supports:** ~~className~~, ~~customClassName~~, ~~html~~ -- **Attributes:** +- **Name:** core/nextpage +- **Category:** design +- **Parent:** core/post-content +- **Supports:** ~~className~~, ~~customClassName~~, ~~html~~ +- **Attributes:** ## Page List Display a list of all pages. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/page-list)) -- **Name:** core/page-list -- **Category:** widgets -- **Supports:** typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** isNested, parentPageID +- **Name:** core/page-list +- **Category:** widgets +- **Supports:** typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** isNested, parentPageID ## Page List Item Displays a page inside a list of all pages. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/page-list-item)) -- **Name:** core/page-list-item -- **Category:** widgets -- **Parent:** core/page-list -- **Supports:** ~~html~~, ~~inserter~~, ~~lock~~, ~~reusable~~ -- **Attributes:** hasChildren, id, label, link, title +- **Name:** core/page-list-item +- **Category:** widgets +- **Parent:** core/page-list +- **Supports:** ~~html~~, ~~inserter~~, ~~lock~~, ~~reusable~~ +- **Attributes:** hasChildren, id, label, link, title ## Paragraph Start with the basic building block of all narrative. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/paragraph)) -- **Name:** core/paragraph -- **Category:** text -- **Supports:** __unstablePasteTextInline, anchor, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~className~~ -- **Attributes:** align, content, direction, dropCap, placeholder +- **Name:** core/paragraph +- **Category:** text +- **Supports:** \_\_unstablePasteTextInline, anchor, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~className~~ +- **Attributes:** align, content, direction, dropCap, placeholder ## Pattern placeholder Show a block pattern. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/pattern)) -- **Name:** core/pattern -- **Category:** theme -- **Supports:** ~~html~~, ~~inserter~~ -- **Attributes:** slug +- **Name:** core/pattern +- **Category:** theme +- **Supports:** ~~html~~, ~~inserter~~ +- **Attributes:** slug ## Post Author Display post author details such as name, avatar, and bio. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-author)) -- **Name:** core/post-author -- **Category:** theme -- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** avatarSize, byline, isLink, linkTarget, showAvatar, showBio, textAlign +- **Name:** core/post-author +- **Category:** theme +- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** avatarSize, byline, isLink, linkTarget, showAvatar, showBio, textAlign ## Post Author Biography The author biography. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-author-biography)) -- **Name:** core/post-author-biography -- **Category:** theme -- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight) -- **Attributes:** textAlign +- **Name:** core/post-author-biography +- **Category:** theme +- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight) +- **Attributes:** textAlign ## Post Author Name The author name. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-author-name)) -- **Name:** core/post-author-name -- **Category:** theme -- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** isLink, linkTarget, textAlign +- **Name:** core/post-author-name +- **Category:** theme +- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** isLink, linkTarget, textAlign ## Post Comment (deprecated) This block is deprecated. Please use the Comments block instead. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-comment)) -- **Name:** core/post-comment -- **Experimental:** fse -- **Category:** theme -- **Supports:** ~~html~~, ~~inserter~~ -- **Attributes:** commentId +- **Name:** core/post-comment +- **Experimental:** fse +- **Category:** theme +- **Supports:** ~~html~~, ~~inserter~~ +- **Attributes:** commentId ## Post Comments Count Display a post's comments count. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-comments-count)) -- **Name:** core/post-comments-count -- **Experimental:** fse -- **Category:** theme -- **Supports:** color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** textAlign +- **Name:** core/post-comments-count +- **Experimental:** fse +- **Category:** theme +- **Supports:** color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** textAlign ## Post Comments Form Display a post's comments form. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-comments-form)) -- **Name:** core/post-comments-form -- **Category:** theme -- **Supports:** color (background, gradients, heading, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** textAlign +- **Name:** core/post-comments-form +- **Category:** theme +- **Supports:** color (background, gradients, heading, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** textAlign ## Post Comments Link Displays the link to the current post comments. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-comments-link)) -- **Name:** core/post-comments-link -- **Experimental:** fse -- **Category:** theme -- **Supports:** color (background, link, ~~text~~), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** textAlign +- **Name:** core/post-comments-link +- **Experimental:** fse +- **Category:** theme +- **Supports:** color (background, link, ~~text~~), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** textAlign ## Post Content Displays the contents of a post or page. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-content)) -- **Name:** core/post-content -- **Category:** theme -- **Supports:** align (full, wide), dimensions (minHeight), layout, typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** +- **Name:** core/post-content +- **Category:** theme +- **Supports:** align (full, wide), dimensions (minHeight), layout, typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** ## Post Date Add the date of this post. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-date)) -- **Name:** core/post-date -- **Category:** theme -- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** displayType, format, isLink, textAlign +- **Name:** core/post-date +- **Category:** theme +- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** displayType, format, isLink, textAlign ## Excerpt Display the excerpt. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-excerpt)) -- **Name:** core/post-excerpt -- **Category:** theme -- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** excerptLength, moreText, showMoreOnNewLine, textAlign +- **Name:** core/post-excerpt +- **Category:** theme +- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** excerptLength, moreText, showMoreOnNewLine, textAlign ## Post Featured Image Display a post's featured image. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-featured-image)) -- **Name:** core/post-featured-image -- **Category:** theme -- **Supports:** align (center, full, left, right, wide), color (~~background~~, ~~text~~), spacing (margin, padding), ~~html~~ -- **Attributes:** aspectRatio, customGradient, customOverlayColor, dimRatio, gradient, height, isLink, linkTarget, overlayColor, rel, scale, sizeSlug, width +- **Name:** core/post-featured-image +- **Category:** theme +- **Supports:** align (center, full, left, right, wide), color (~~background~~, ~~text~~), spacing (margin, padding), ~~html~~ +- **Attributes:** aspectRatio, customGradient, customOverlayColor, dimRatio, gradient, height, isLink, linkTarget, overlayColor, rel, scale, sizeSlug, width ## Post Navigation Link Displays the next or previous post link that is adjacent to the current post. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-navigation-link)) -- **Name:** core/post-navigation-link -- **Category:** theme -- **Supports:** color (background, link, text), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** arrow, label, linkLabel, showTitle, textAlign, type +- **Name:** core/post-navigation-link +- **Category:** theme +- **Supports:** anchor, color (background, link, text), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** arrow, excludedTerms, inSameTerm label, linkLabel, showTitle, taxonomy, textAlign, type ## Post Template Contains the block elements used to render a post, like the title, date, featured image, content or excerpt, and more. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-template)) -- **Name:** core/post-template -- **Category:** theme -- **Parent:** core/query -- **Supports:** align (full, wide), color (background, gradients, link, text), layout, spacing (blockGap), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** +- **Name:** core/post-template +- **Category:** theme +- **Parent:** core/query +- **Supports:** align (full, wide), color (background, gradients, link, text), layout, spacing (blockGap), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** ## Post Terms Post terms. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-terms)) -- **Name:** core/post-terms -- **Category:** theme -- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** prefix, separator, suffix, term, textAlign +- **Name:** core/post-terms +- **Category:** theme +- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** prefix, separator, suffix, term, textAlign ## Time To Read Show minutes required to finish reading the post. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-time-to-read)) -- **Name:** core/post-time-to-read -- **Experimental:** true -- **Category:** theme -- **Supports:** color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** textAlign +- **Name:** core/post-time-to-read +- **Experimental:** true +- **Category:** theme +- **Supports:** color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** textAlign ## Title Displays the title of a post, page, or any other content-type. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-title)) -- **Name:** core/post-title -- **Category:** theme -- **Supports:** align (full, wide), color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** isLink, level, linkTarget, rel, textAlign +- **Name:** core/post-title +- **Category:** theme +- **Supports:** align (full, wide), color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** isLink, level, linkTarget, rel, textAlign ## Preformatted Add text that respects your spacing and tabs, and also allows styling. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/preformatted)) -- **Name:** core/preformatted -- **Category:** text -- **Supports:** anchor, color (background, gradients, text), typography (fontSize, lineHeight) -- **Attributes:** content +- **Name:** core/preformatted +- **Category:** text +- **Supports:** anchor, color (background, gradients, text), typography (fontSize, lineHeight) +- **Attributes:** content ## Pullquote Give special visual emphasis to a quote from your text. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/pullquote)) -- **Name:** core/pullquote -- **Category:** text -- **Supports:** align (full, left, right, wide), anchor, color (background, gradients, link, text), typography (fontSize, lineHeight) -- **Attributes:** citation, textAlign, value +- **Name:** core/pullquote +- **Category:** text +- **Supports:** align (full, left, right, wide), anchor, color (background, gradients, link, text), typography (fontSize, lineHeight) +- **Attributes:** citation, textAlign, value ## Query Loop An advanced block that allows displaying post types based on different query parameters and visual configurations. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/query)) -- **Name:** core/query -- **Category:** theme -- **Supports:** align (full, wide), layout, ~~html~~ -- **Attributes:** namespace, query, queryId, tagName +- **Name:** core/query +- **Category:** theme +- **Supports:** align (full, wide), layout, ~~html~~ +- **Attributes:** namespace, query, queryId, tagName ## No results Contains the block elements used to render content when no query results are found. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/query-no-results)) -- **Name:** core/query-no-results -- **Category:** theme -- **Parent:** core/query -- **Supports:** align, color (background, gradients, link, text), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** +- **Name:** core/query-no-results +- **Category:** theme +- **Parent:** core/query +- **Supports:** align, color (background, gradients, link, text), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** ## Pagination Displays a paginated navigation to next/previous set of posts, when applicable. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/query-pagination)) -- **Name:** core/query-pagination -- **Category:** theme -- **Parent:** core/query -- **Supports:** align, color (background, gradients, link, text), layout (default, ~~allowInheriting~~, ~~allowSwitching~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** paginationArrow, showLabel +- **Name:** core/query-pagination +- **Category:** theme +- **Parent:** core/query +- **Supports:** align, color (background, gradients, link, text), layout (default, ~~allowInheriting~~, ~~allowSwitching~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** paginationArrow, showLabel ## Next Page Displays the next posts page link. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/query-pagination-next)) -- **Name:** core/query-pagination-next -- **Category:** theme -- **Parent:** core/query-pagination -- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** label +- **Name:** core/query-pagination-next +- **Category:** theme +- **Parent:** core/query-pagination +- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** label ## Page Numbers Displays a list of page numbers for pagination ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/query-pagination-numbers)) -- **Name:** core/query-pagination-numbers -- **Category:** theme -- **Parent:** core/query-pagination -- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** +- **Name:** core/query-pagination-numbers +- **Category:** theme +- **Parent:** core/query-pagination +- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** ## Previous Page Displays the previous posts page link. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/query-pagination-previous)) -- **Name:** core/query-pagination-previous -- **Category:** theme -- **Parent:** core/query-pagination -- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** label +- **Name:** core/query-pagination-previous +- **Category:** theme +- **Parent:** core/query-pagination +- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** label ## Query Title Display the query title. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/query-title)) -- **Name:** core/query-title -- **Category:** theme -- **Supports:** align (full, wide), color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** level, showPrefix, showSearchTerm, textAlign, type +- **Name:** core/query-title +- **Category:** theme +- **Supports:** align (full, wide), color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** level, showPrefix, showSearchTerm, textAlign, type ## Quote Give quoted text visual emphasis. "In quoting others, we cite ourselves." — Julio Cortázar ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/quote)) -- **Name:** core/quote -- **Category:** text -- **Supports:** anchor, color (background, gradients, heading, link, text), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** align, citation, value +- **Name:** core/quote +- **Category:** text +- **Supports:** anchor, color (background, gradients, heading, link, text), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** align, citation, value ## Read More Displays the link of a post, page, or any other content-type. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/read-more)) -- **Name:** core/read-more -- **Category:** theme -- **Supports:** color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** content, linkTarget +- **Name:** core/read-more +- **Category:** theme +- **Supports:** color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** content, linkTarget ## RSS Display entries from any RSS or Atom feed. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/rss)) -- **Name:** core/rss -- **Category:** widgets -- **Supports:** align, ~~html~~ -- **Attributes:** blockLayout, columns, displayAuthor, displayDate, displayExcerpt, excerptLength, feedURL, itemsToShow +- **Name:** core/rss +- **Category:** widgets +- **Supports:** align, ~~html~~ +- **Attributes:** blockLayout, columns, displayAuthor, displayDate, displayExcerpt, excerptLength, feedURL, itemsToShow ## Search Help visitors find your content. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/search)) -- **Name:** core/search -- **Category:** widgets -- **Supports:** align (center, left, right), color (background, gradients, text), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** buttonBehavior, buttonPosition, buttonText, buttonUseIcon, isSearchFieldHidden, label, placeholder, query, showLabel, width, widthUnit +- **Name:** core/search +- **Category:** widgets +- **Supports:** align (center, left, right), color (background, gradients, text), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** buttonBehavior, buttonPosition, buttonText, buttonUseIcon, isSearchFieldHidden, label, placeholder, query, showLabel, width, widthUnit ## Separator Create a break between ideas or sections with a horizontal separator. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/separator)) -- **Name:** core/separator -- **Category:** design -- **Supports:** align (center, full, wide), anchor, color (background, gradients, ~~enableContrastChecker~~, ~~text~~), spacing (margin) -- **Attributes:** opacity +- **Name:** core/separator +- **Category:** design +- **Supports:** align (center, full, wide), anchor, color (background, gradients, ~~enableContrastChecker~~, ~~text~~), spacing (margin) +- **Attributes:** opacity ## Shortcode Insert additional custom elements with a WordPress shortcode. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/shortcode)) -- **Name:** core/shortcode -- **Category:** widgets -- **Supports:** ~~className~~, ~~customClassName~~, ~~html~~ -- **Attributes:** text +- **Name:** core/shortcode +- **Category:** widgets +- **Supports:** ~~className~~, ~~customClassName~~, ~~html~~ +- **Attributes:** text ## Site Logo Display an image to represent this site. Update this block and the changes apply everywhere. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/site-logo)) -- **Name:** core/site-logo -- **Category:** theme -- **Supports:** align, color (~~background~~, ~~text~~), spacing (margin, padding), ~~alignWide~~, ~~html~~ -- **Attributes:** isLink, linkTarget, shouldSyncIcon, width +- **Name:** core/site-logo +- **Category:** theme +- **Supports:** align, color (~~background~~, ~~text~~), spacing (margin, padding), ~~alignWide~~, ~~html~~ +- **Attributes:** isLink, linkTarget, shouldSyncIcon, width ## Site Tagline Describe in a few words what the site is about. The tagline can be used in search results or when sharing on social networks even if it’s not displayed in the theme design. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/site-tagline)) -- **Name:** core/site-tagline -- **Category:** theme -- **Supports:** align (full, wide), color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** textAlign +- **Name:** core/site-tagline +- **Category:** theme +- **Supports:** align (full, wide), color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** textAlign ## Site Title Displays the name of this site. Update the block, and the changes apply everywhere it’s used. This will also appear in the browser title bar and in search results. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/site-title)) -- **Name:** core/site-title -- **Category:** theme -- **Supports:** align (full, wide), color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** isLink, level, linkTarget, textAlign +- **Name:** core/site-title +- **Category:** theme +- **Supports:** align (full, wide), color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** isLink, level, linkTarget, textAlign ## Social Icon Display an icon linking to a social media profile or site. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/social-link)) -- **Name:** core/social-link -- **Category:** widgets -- **Parent:** core/social-links -- **Supports:** ~~html~~, ~~reusable~~ -- **Attributes:** label, rel, service, url +- **Name:** core/social-link +- **Category:** widgets +- **Parent:** core/social-links +- **Supports:** ~~html~~, ~~reusable~~ +- **Attributes:** label, rel, service, url ## Social Icons Display icons linking to your social media profiles or sites. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/social-links)) -- **Name:** core/social-links -- **Category:** widgets -- **Supports:** align (center, left, right), anchor, color (background, gradients, ~~enableContrastChecker~~, ~~text~~), layout (default, ~~allowInheriting~~, ~~allowSwitching~~, ~~allowVerticalAlignment~~), spacing (blockGap, margin, padding, units) -- **Attributes:** customIconBackgroundColor, customIconColor, iconBackgroundColor, iconBackgroundColorValue, iconColor, iconColorValue, openInNewTab, showLabels, size +- **Name:** core/social-links +- **Category:** widgets +- **Supports:** align (center, left, right), anchor, color (background, gradients, ~~enableContrastChecker~~, ~~text~~), layout (default, ~~allowInheriting~~, ~~allowSwitching~~, ~~allowVerticalAlignment~~), spacing (blockGap, margin, padding, units) +- **Attributes:** customIconBackgroundColor, customIconColor, iconBackgroundColor, iconBackgroundColorValue, iconColor, iconColorValue, openInNewTab, showLabels, size ## Spacer Add white space between blocks and customize its height. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/spacer)) -- **Name:** core/spacer -- **Category:** design -- **Supports:** anchor, spacing (margin) -- **Attributes:** height, width +- **Name:** core/spacer +- **Category:** design +- **Supports:** anchor, spacing (margin) +- **Attributes:** height, width ## Table Create structured content in rows and columns to display information. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/table)) -- **Name:** core/table -- **Category:** text -- **Supports:** align, anchor, color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight) -- **Attributes:** body, caption, foot, hasFixedLayout, head +- **Name:** core/table +- **Category:** text +- **Supports:** align, anchor, color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight) +- **Attributes:** body, caption, foot, hasFixedLayout, head ## Table of Contents Summarize your post with a list of headings. Add HTML anchors to Heading blocks to link them here. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/table-of-contents)) -- **Name:** core/table-of-contents -- **Experimental:** true -- **Category:** layout -- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** headings, onlyIncludeCurrentPage +- **Name:** core/table-of-contents +- **Experimental:** true +- **Category:** layout +- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** headings, onlyIncludeCurrentPage ## Tag Cloud A cloud of your most used tags. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/tag-cloud)) -- **Name:** core/tag-cloud -- **Category:** widgets -- **Supports:** align, spacing (margin, padding), typography (lineHeight), ~~html~~ -- **Attributes:** largestFontSize, numberOfTags, showTagCounts, smallestFontSize, taxonomy +- **Name:** core/tag-cloud +- **Category:** widgets +- **Supports:** align, spacing (margin, padding), typography (lineHeight), ~~html~~ +- **Attributes:** largestFontSize, numberOfTags, showTagCounts, smallestFontSize, taxonomy ## Template Part Edit the different global regions of your site, like the header, footer, sidebar, or create your own. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/template-part)) -- **Name:** core/template-part -- **Category:** theme -- **Supports:** align, ~~html~~, ~~reusable~~ -- **Attributes:** area, slug, tagName, theme +- **Name:** core/template-part +- **Category:** theme +- **Supports:** align, ~~html~~, ~~reusable~~ +- **Attributes:** area, slug, tagName, theme ## Term Description Display the description of categories, tags and custom taxonomies when viewing an archive. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/term-description)) -- **Name:** core/term-description -- **Experimental:** fse -- **Category:** theme -- **Supports:** align (full, wide), color (background, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** textAlign +- **Name:** core/term-description +- **Experimental:** fse +- **Category:** theme +- **Supports:** align (full, wide), color (background, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** textAlign ## Text Columns (deprecated) This block is deprecated. Please use the Columns block instead. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/text-columns)) -- **Name:** core/text-columns -- **Category:** design -- **Supports:** ~~inserter~~ -- **Attributes:** columns, content, width +- **Name:** core/text-columns +- **Category:** design +- **Supports:** ~~inserter~~ +- **Attributes:** columns, content, width ## Verse Insert poetry. Use special spacing formats. Or quote song lyrics. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/verse)) -- **Name:** core/verse -- **Category:** text -- **Supports:** anchor, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight) -- **Attributes:** content, textAlign +- **Name:** core/verse +- **Category:** text +- **Supports:** anchor, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight) +- **Attributes:** content, textAlign ## Video Embed a video from your media library or upload a new one. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/video)) -- **Name:** core/video -- **Category:** media -- **Supports:** align, anchor, spacing (margin, padding) -- **Attributes:** autoplay, caption, controls, id, loop, muted, playsInline, poster, preload, src, tracks +- **Name:** core/video +- **Category:** media +- **Supports:** align, anchor, spacing (margin, padding) +- **Attributes:** autoplay, caption, controls, id, loop, muted, playsInline, poster, preload, src, tracks diff --git a/packages/block-library/src/post-navigation-link/block.json b/packages/block-library/src/post-navigation-link/block.json index e1b6d4fa90a40c..5a71c477820bb6 100644 --- a/packages/block-library/src/post-navigation-link/block.json +++ b/packages/block-library/src/post-navigation-link/block.json @@ -28,6 +28,16 @@ "arrow": { "type": "string", "default": "none" + }, + "excludedTerms": { + "type": "string" + }, + "inSameTerm": { + "type": "boolean" + }, + "taxonomy": { + "type": "string", + "default": "category" } }, "supports": { diff --git a/packages/block-library/src/post-navigation-link/edit.js b/packages/block-library/src/post-navigation-link/edit.js index f899788428bcdb..cdbeaf420f062c 100644 --- a/packages/block-library/src/post-navigation-link/edit.js +++ b/packages/block-library/src/post-navigation-link/edit.js @@ -10,7 +10,9 @@ import { __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, ToggleControl, + SelectControl, PanelBody, + __experimentalInputControl as InputControl, } from '@wordpress/components'; import { InspectorControls, @@ -22,7 +24,17 @@ import { import { __, _x } from '@wordpress/i18n'; export default function PostNavigationLinkEdit( { - attributes: { type, label, showTitle, textAlign, linkLabel, arrow }, + attributes: { + type, + label, + showTitle, + textAlign, + linkLabel, + arrow, + inSameTerm, + taxonomy, + excludedTerms, + }, setAttributes, } ) { const isNext = type === 'next'; @@ -47,6 +59,7 @@ export default function PostNavigationLinkEdit( { [ `has-text-align-${ textAlign }` ]: textAlign, } ), } ); + return ( <> @@ -112,6 +125,46 @@ export default function PostNavigationLinkEdit( { ) } /> + + setAttributes( { + inSameTerm: ! inSameTerm, + } ) + } + /> + { inSameTerm && ( + <> + + setAttributes( { taxonomy: value } ) + } + /> + + setAttributes( { excludedTerms: value } ) + } + /> + + ) } diff --git a/packages/block-library/src/post-navigation-link/index.php b/packages/block-library/src/post-navigation-link/index.php index cb1fe568bdf0e7..9d752e82f1b984 100644 --- a/packages/block-library/src/post-navigation-link/index.php +++ b/packages/block-library/src/post-navigation-link/index.php @@ -94,10 +94,14 @@ function render_block_core_post_navigation_link( $attributes, $content ) { } } + $in_same_term = isset( $attributes['inSameTerm'] ) ? $attributes['inSameTerm'] : false; + $excluded_terms = isset( $attributes['excludedTerms'] ) && $in_same_term ? $attributes['excludedTerms'] : ''; + $taxonomy = isset( $attributes['taxonomy'] ) && $in_same_term ? $attributes['taxonomy'] : ''; + // The dynamic portion of the function name, `$navigation_type`, // refers to the type of adjacency, 'next' or 'previous'. $get_link_function = "get_{$navigation_type}_post_link"; - $content = $get_link_function( $format, $link ); + $content = $get_link_function( $format, $link, $in_same_term, $excluded_terms, $taxonomy ); return sprintf( '
%2$s
', $wrapper_attributes, From aefb961c96e93caf193a1113718d0c3463a7f6f7 Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Tue, 7 Mar 2023 06:37:57 +0100 Subject: [PATCH 02/17] Update core__post-navigation-link.json --- .../fixtures/blocks/core__post-navigation-link.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/integration/fixtures/blocks/core__post-navigation-link.json b/test/integration/fixtures/blocks/core__post-navigation-link.json index 9689f956f11509..081ccbedfadc7a 100644 --- a/test/integration/fixtures/blocks/core__post-navigation-link.json +++ b/test/integration/fixtures/blocks/core__post-navigation-link.json @@ -6,7 +6,8 @@ "type": "next", "showTitle": false, "linkLabel": false, - "arrow": "none" + "arrow": "none", + "taxonomy": "category" }, "innerBlocks": [] } From ec7dc9da5b0014b761e4556ffe267b566949d00a Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Wed, 8 Mar 2023 08:14:25 +0100 Subject: [PATCH 03/17] Support custom post types and custom taxonomies --- .../src/post-navigation-link/edit.js | 82 +++++++++++++------ .../src/post-navigation-link/index.php | 24 +++++- 2 files changed, 78 insertions(+), 28 deletions(-) diff --git a/packages/block-library/src/post-navigation-link/edit.js b/packages/block-library/src/post-navigation-link/edit.js index cdbeaf420f062c..542c3d5918bf2c 100644 --- a/packages/block-library/src/post-navigation-link/edit.js +++ b/packages/block-library/src/post-navigation-link/edit.js @@ -22,6 +22,8 @@ import { useBlockProps, } from '@wordpress/block-editor'; import { __, _x } from '@wordpress/i18n'; +import { useSelect } from '@wordpress/data'; +import { store as coreStore } from '@wordpress/core-data'; export default function PostNavigationLinkEdit( { attributes: { @@ -60,6 +62,41 @@ export default function PostNavigationLinkEdit( { } ), } ); + // We need to know the post type in order to get all supported taxonomies. + const postType = useSelect( + // FIXME: @wordpress/block-library should not depend on @wordpress/editor. + // Blocks can be loaded into a *non-post* block editor. + // eslint-disable-next-line @wordpress/data-no-store-string-literals + ( select ) => select( 'core/editor' ).getCurrentPostType(), + [] + ); + const taxonomies = useSelect( ( select ) => { + const { getTaxonomies } = select( coreStore ); + const filteredTaxonomies = getTaxonomies( { + type: postType, + per_page: -1, + context: 'view', + } ); + return filteredTaxonomies; + }, [] ); + const getTaxonomyOptions = () => { + const selectOption = { + label: __( '- Select -' ), + value: '', + disabled: true, + }; + const taxonomyOptions = ( taxonomies ?? [] ) + .filter( ( tax ) => tax.slug !== 'nav_menu' ) + .map( ( item ) => { + return { + value: item.slug, + label: item.name, + }; + } ); + + return [ selectOption, ...taxonomyOptions ]; + }; + return ( <> @@ -125,6 +162,8 @@ export default function PostNavigationLinkEdit( { ) } /> + + { inSameTerm && ( - <> - - setAttributes( { taxonomy: value } ) - } - /> - - setAttributes( { excludedTerms: value } ) - } - /> - + + setAttributes( { taxonomy: value } ) + } + /> ) } + + setAttributes( { excludedTerms: value } ) + } + /> diff --git a/packages/block-library/src/post-navigation-link/index.php b/packages/block-library/src/post-navigation-link/index.php index 9d752e82f1b984..1631c63fe2cfa9 100644 --- a/packages/block-library/src/post-navigation-link/index.php +++ b/packages/block-library/src/post-navigation-link/index.php @@ -95,8 +95,30 @@ function render_block_core_post_navigation_link( $attributes, $content ) { } $in_same_term = isset( $attributes['inSameTerm'] ) ? $attributes['inSameTerm'] : false; - $excluded_terms = isset( $attributes['excludedTerms'] ) && $in_same_term ? $attributes['excludedTerms'] : ''; $taxonomy = isset( $attributes['taxonomy'] ) && $in_same_term ? $attributes['taxonomy'] : ''; + $excluded_terms = ''; + + // Get the term id of each excluded term. + if ( isset( $attributes['excludedTerms'] ) ) { + $excluded_terms = explode( ',', sanitize_text_field( $attributes['excludedTerms'] ) ); + //Get the taxonomies of the current post type + $taxonomies = get_object_taxonomies( get_post_type() ); + //The user may have entered the taxonomy slug, name or id. + $types = array( 'slug', 'name', 'term_id', 'id', 'ID', 'term_taxonomy_id' ); + $result = array(); + foreach ( $excluded_terms as $term ) { + $term = trim( $term ); + foreach ( $taxonomies as $taxonomy ) { + foreach ( $types as $type ) { + $termid = get_term_by( $type, $term, $taxonomy ); + if ( $termid ) { + $result[] = $termid->term_taxonomy_id; + } + } + } + } + $excluded_terms = array_unique( $result ); + } // The dynamic portion of the function name, `$navigation_type`, // refers to the type of adjacency, 'next' or 'previous'. From 393afa83c03e163256800677875e843aa1b080d8 Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Wed, 8 Mar 2023 08:26:34 +0100 Subject: [PATCH 04/17] fix CS issues --- packages/block-library/src/post-navigation-link/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/post-navigation-link/index.php b/packages/block-library/src/post-navigation-link/index.php index 1631c63fe2cfa9..ab68feda1a801a 100644 --- a/packages/block-library/src/post-navigation-link/index.php +++ b/packages/block-library/src/post-navigation-link/index.php @@ -101,9 +101,9 @@ function render_block_core_post_navigation_link( $attributes, $content ) { // Get the term id of each excluded term. if ( isset( $attributes['excludedTerms'] ) ) { $excluded_terms = explode( ',', sanitize_text_field( $attributes['excludedTerms'] ) ); - //Get the taxonomies of the current post type + // Get the taxonomies of the current post type. $taxonomies = get_object_taxonomies( get_post_type() ); - //The user may have entered the taxonomy slug, name or id. + // The user may have entered the taxonomy slug, name or id. $types = array( 'slug', 'name', 'term_id', 'id', 'ID', 'term_taxonomy_id' ); $result = array(); foreach ( $excluded_terms as $term ) { From 3341d555c143308aad1021a043ef994449d3fc2d Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Fri, 10 Mar 2023 10:23:39 +0100 Subject: [PATCH 05/17] Update index.php --- packages/block-library/src/post-navigation-link/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/post-navigation-link/index.php b/packages/block-library/src/post-navigation-link/index.php index ab68feda1a801a..cfe54eac59be06 100644 --- a/packages/block-library/src/post-navigation-link/index.php +++ b/packages/block-library/src/post-navigation-link/index.php @@ -99,7 +99,7 @@ function render_block_core_post_navigation_link( $attributes, $content ) { $excluded_terms = ''; // Get the term id of each excluded term. - if ( isset( $attributes['excludedTerms'] ) ) { + if ( isset( $attributes['excludedTerms'] ) && ! empty( $attributes['excludedTerms'] ) ) { $excluded_terms = explode( ',', sanitize_text_field( $attributes['excludedTerms'] ) ); // Get the taxonomies of the current post type. $taxonomies = get_object_taxonomies( get_post_type() ); From 7836c63514b85359d9fec92e973fc18be30712c9 Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Tue, 14 Mar 2023 09:30:54 +0100 Subject: [PATCH 06/17] Update index.php --- .../src/post-navigation-link/index.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/block-library/src/post-navigation-link/index.php b/packages/block-library/src/post-navigation-link/index.php index cfe54eac59be06..bd5ce711ee3e43 100644 --- a/packages/block-library/src/post-navigation-link/index.php +++ b/packages/block-library/src/post-navigation-link/index.php @@ -94,9 +94,12 @@ function render_block_core_post_navigation_link( $attributes, $content ) { } } - $in_same_term = isset( $attributes['inSameTerm'] ) ? $attributes['inSameTerm'] : false; - $taxonomy = isset( $attributes['taxonomy'] ) && $in_same_term ? $attributes['taxonomy'] : ''; - $excluded_terms = ''; + $in_same_term = isset( $attributes['inSameTerm'] ) ? $attributes['inSameTerm'] : false; + $taxonomy = isset( $attributes['taxonomy'] ) && $in_same_term ? $attributes['taxonomy'] : ''; + + // The dynamic portion of the function name, `$navigation_type`, + // refers to the type of adjacency, 'next' or 'previous'. + $get_link_function = "get_{$navigation_type}_post_link"; // Get the term id of each excluded term. if ( isset( $attributes['excludedTerms'] ) && ! empty( $attributes['excludedTerms'] ) ) { @@ -118,12 +121,11 @@ function render_block_core_post_navigation_link( $attributes, $content ) { } } $excluded_terms = array_unique( $result ); + $content = $get_link_function( $format, $link, $in_same_term, $excluded_terms, $taxonomy ); + } else { + $content = $get_link_function( $format, $link, $in_same_term, $taxonomy ); } - // The dynamic portion of the function name, `$navigation_type`, - // refers to the type of adjacency, 'next' or 'previous'. - $get_link_function = "get_{$navigation_type}_post_link"; - $content = $get_link_function( $format, $link, $in_same_term, $excluded_terms, $taxonomy ); return sprintf( '
%2$s
', $wrapper_attributes, From 1a11e8a020856f6236df21aa20b106d7b6e2a3af Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Sat, 17 Jun 2023 11:37:56 +0200 Subject: [PATCH 07/17] Update edit.js --- .../src/post-navigation-link/edit.js | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/packages/block-library/src/post-navigation-link/edit.js b/packages/block-library/src/post-navigation-link/edit.js index 542c3d5918bf2c..b4b11ce5a2aa7f 100644 --- a/packages/block-library/src/post-navigation-link/edit.js +++ b/packages/block-library/src/post-navigation-link/edit.js @@ -70,15 +70,18 @@ export default function PostNavigationLinkEdit( { ( select ) => select( 'core/editor' ).getCurrentPostType(), [] ); - const taxonomies = useSelect( ( select ) => { - const { getTaxonomies } = select( coreStore ); - const filteredTaxonomies = getTaxonomies( { - type: postType, - per_page: -1, - context: 'view', - } ); - return filteredTaxonomies; - }, [] ); + const taxonomies = useSelect( + ( select ) => { + const { getTaxonomies } = select( coreStore ); + const filteredTaxonomies = getTaxonomies( { + type: postType, + per_page: -1, + context: 'view', + } ); + return filteredTaxonomies; + }, + [ postType ] + ); const getTaxonomyOptions = () => { const selectOption = { label: __( '- Select -' ), @@ -165,9 +168,7 @@ export default function PostNavigationLinkEdit( { setAttributes( { From 449a40a758948fcc7e455b97f149d5782b9b6600 Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Wed, 12 Jul 2023 10:07:54 +0200 Subject: [PATCH 08/17] try to fix spacing in core-blocks.md --- docs/reference-guides/core-blocks.md | 824 +++++++++++++-------------- 1 file changed, 412 insertions(+), 412 deletions(-) diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index 2a4391abbcfe2f..7d242db12b5109 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -12,265 +12,265 @@ This page lists the blocks included in the block-library package. Display a date archive of your posts. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/archives)) -- **Name:** core/archives -- **Category:** widgets -- **Supports:** align, spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** displayAsDropdown, showLabel, showPostCounts, type +- **Name:** core/archives +- **Category:** widgets +- **Supports:** align, spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** displayAsDropdown, showLabel, showPostCounts, type ## Audio Embed a simple audio player. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/audio)) -- **Name:** core/audio -- **Category:** media -- **Supports:** align, anchor, spacing (margin, padding) -- **Attributes:** autoplay, caption, id, loop, preload, src +- **Name:** core/audio +- **Category:** media +- **Supports:** align, anchor, spacing (margin, padding) +- **Attributes:** autoplay, caption, id, loop, preload, src ## Avatar Add a user’s avatar. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/avatar)) -- **Name:** core/avatar -- **Category:** theme -- **Supports:** align, color (~~background~~, ~~text~~), spacing (margin, padding), ~~alignWide~~, ~~html~~ -- **Attributes:** isLink, linkTarget, size, userId +- **Name:** core/avatar +- **Category:** theme +- **Supports:** align, color (~~background~~, ~~text~~), spacing (margin, padding), ~~alignWide~~, ~~html~~ +- **Attributes:** isLink, linkTarget, size, userId ## Pattern Create and save content to reuse across your site. Update the pattern, and the changes apply everywhere it’s used. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/block)) -- **Name:** core/block -- **Category:** reusable -- **Supports:** ~~customClassName~~, ~~html~~, ~~inserter~~ -- **Attributes:** ref +- **Name:** core/block +- **Category:** reusable +- **Supports:** ~~customClassName~~, ~~html~~, ~~inserter~~ +- **Attributes:** ref ## Button Prompt visitors to take action with a button-style link. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/button)) -- **Name:** core/button -- **Category:** design -- **Parent:** core/buttons -- **Supports:** anchor, color (background, gradients, text), shadow, spacing (padding), typography (fontSize, lineHeight), ~~alignWide~~, ~~align~~, ~~reusable~~ -- **Attributes:** backgroundColor, gradient, linkTarget, placeholder, rel, text, textAlign, textColor, title, url, width +- **Name:** core/button +- **Category:** design +- **Parent:** core/buttons +- **Supports:** anchor, color (background, gradients, text), shadow, spacing (padding), typography (fontSize, lineHeight), ~~alignWide~~, ~~align~~, ~~reusable~~ +- **Attributes:** backgroundColor, gradient, linkTarget, placeholder, rel, text, textAlign, textColor, title, url, width ## Buttons Prompt visitors to take action with a group of button-style links. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/buttons)) -- **Name:** core/buttons -- **Category:** design -- **Supports:** align (full, wide), anchor, layout (default, ~~allowInheriting~~, ~~allowSwitching~~), spacing (blockGap, margin), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** +- **Name:** core/buttons +- **Category:** design +- **Supports:** align (full, wide), anchor, layout (default, ~~allowInheriting~~, ~~allowSwitching~~), spacing (blockGap, margin), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** ## Calendar A calendar of your site’s posts. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/calendar)) -- **Name:** core/calendar -- **Category:** widgets -- **Supports:** align, color (background, link, text), typography (fontSize, lineHeight) -- **Attributes:** month, year +- **Name:** core/calendar +- **Category:** widgets +- **Supports:** align, color (background, link, text), typography (fontSize, lineHeight) +- **Attributes:** month, year ## Categories List Display a list of all categories. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/categories)) -- **Name:** core/categories -- **Category:** widgets -- **Supports:** align, spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** displayAsDropdown, showEmpty, showHierarchy, showOnlyTopLevel, showPostCounts +- **Name:** core/categories +- **Category:** widgets +- **Supports:** align, spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** displayAsDropdown, showEmpty, showHierarchy, showOnlyTopLevel, showPostCounts ## Code Display code snippets that respect your spacing and tabs. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/code)) -- **Name:** core/code -- **Category:** text -- **Supports:** align (wide), anchor, color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight) -- **Attributes:** content +- **Name:** core/code +- **Category:** text +- **Supports:** align (wide), anchor, color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight) +- **Attributes:** content ## Column A single column within a columns block. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/column)) -- **Name:** core/column -- **Category:** design -- **Parent:** core/columns -- **Supports:** anchor, color (background, gradients, heading, link, text), layout, spacing (blockGap, padding), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** allowedBlocks, templateLock, verticalAlignment, width +- **Name:** core/column +- **Category:** design +- **Parent:** core/columns +- **Supports:** anchor, color (background, gradients, heading, link, text), layout, spacing (blockGap, padding), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** allowedBlocks, templateLock, verticalAlignment, width ## Columns Display content in multiple columns, with blocks added to each column. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/columns)) -- **Name:** core/columns -- **Category:** design -- **Supports:** align (full, wide), anchor, color (background, gradients, link, text), layout (default, ~~allowEditing~~, ~~allowInheriting~~, ~~allowSwitching~~), spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** isStackedOnMobile, templateLock, verticalAlignment +- **Name:** core/columns +- **Category:** design +- **Supports:** align (full, wide), anchor, color (background, gradients, link, text), layout (default, ~~allowEditing~~, ~~allowInheriting~~, ~~allowSwitching~~), spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** isStackedOnMobile, templateLock, verticalAlignment ## Comment Author Avatar (deprecated) This block is deprecated. Please use the Avatar block instead. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comment-author-avatar)) -- **Name:** core/comment-author-avatar -- **Experimental:** fse -- **Category:** theme -- **Supports:** color (background, ~~text~~), spacing (margin, padding), ~~html~~, ~~inserter~~ -- **Attributes:** height, width +- **Name:** core/comment-author-avatar +- **Experimental:** fse +- **Category:** theme +- **Supports:** color (background, ~~text~~), spacing (margin, padding), ~~html~~, ~~inserter~~ +- **Attributes:** height, width ## Comment Author Name Displays the name of the author of the comment. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comment-author-name)) -- **Name:** core/comment-author-name -- **Category:** theme -- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** isLink, linkTarget, textAlign +- **Name:** core/comment-author-name +- **Category:** theme +- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** isLink, linkTarget, textAlign ## Comment Content Displays the contents of a comment. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comment-content)) -- **Name:** core/comment-content -- **Category:** theme -- **Supports:** color (background, gradients, link, text), spacing (padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** textAlign +- **Name:** core/comment-content +- **Category:** theme +- **Supports:** color (background, gradients, link, text), spacing (padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** textAlign ## Comment Date Displays the date on which the comment was posted. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comment-date)) -- **Name:** core/comment-date -- **Category:** theme -- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** format, isLink +- **Name:** core/comment-date +- **Category:** theme +- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** format, isLink ## Comment Edit Link Displays a link to edit the comment in the WordPress Dashboard. This link is only visible to users with the edit comment capability. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comment-edit-link)) -- **Name:** core/comment-edit-link -- **Category:** theme -- **Supports:** color (background, gradients, link, ~~text~~), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** linkTarget, textAlign +- **Name:** core/comment-edit-link +- **Category:** theme +- **Supports:** color (background, gradients, link, ~~text~~), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** linkTarget, textAlign ## Comment Reply Link Displays a link to reply to a comment. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comment-reply-link)) -- **Name:** core/comment-reply-link -- **Category:** theme -- **Supports:** color (background, gradients, link, ~~text~~), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** textAlign +- **Name:** core/comment-reply-link +- **Category:** theme +- **Supports:** color (background, gradients, link, ~~text~~), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** textAlign ## Comment Template Contains the block elements used to display a comment, like the title, date, author, avatar and more. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comment-template)) -- **Name:** core/comment-template -- **Category:** design -- **Parent:** core/comments -- **Supports:** align, spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** +- **Name:** core/comment-template +- **Category:** design +- **Parent:** core/comments +- **Supports:** align, spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** ## Comments An advanced block that allows displaying post comments using different visual configurations. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comments)) -- **Name:** core/comments -- **Category:** theme -- **Supports:** align (full, wide), color (background, gradients, heading, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** legacy, tagName +- **Name:** core/comments +- **Category:** theme +- **Supports:** align (full, wide), color (background, gradients, heading, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** legacy, tagName ## Comments Pagination Displays a paginated navigation to next/previous set of comments, when applicable. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comments-pagination)) -- **Name:** core/comments-pagination -- **Category:** theme -- **Parent:** core/comments -- **Supports:** align, color (background, gradients, link, text), layout (default, ~~allowInheriting~~, ~~allowSwitching~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** paginationArrow +- **Name:** core/comments-pagination +- **Category:** theme +- **Parent:** core/comments +- **Supports:** align, color (background, gradients, link, text), layout (default, ~~allowInheriting~~, ~~allowSwitching~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** paginationArrow ## Comments Next Page Displays the next comment's page link. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comments-pagination-next)) -- **Name:** core/comments-pagination-next -- **Category:** theme -- **Parent:** core/comments-pagination -- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** label +- **Name:** core/comments-pagination-next +- **Category:** theme +- **Parent:** core/comments-pagination +- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** label ## Comments Page Numbers Displays a list of page numbers for comments pagination. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comments-pagination-numbers)) -- **Name:** core/comments-pagination-numbers -- **Category:** theme -- **Parent:** core/comments-pagination -- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** +- **Name:** core/comments-pagination-numbers +- **Category:** theme +- **Parent:** core/comments-pagination +- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** ## Comments Previous Page Displays the previous comment's page link. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comments-pagination-previous)) -- **Name:** core/comments-pagination-previous -- **Category:** theme -- **Parent:** core/comments-pagination -- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** label +- **Name:** core/comments-pagination-previous +- **Category:** theme +- **Parent:** core/comments-pagination +- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** label ## Comments Title Displays a title with the number of comments ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/comments-title)) -- **Name:** core/comments-title -- **Category:** theme -- **Supports:** align, color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~anchor~~, ~~html~~ -- **Attributes:** level, showCommentsCount, showPostTitle, textAlign +- **Name:** core/comments-title +- **Category:** theme +- **Supports:** align, color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~anchor~~, ~~html~~ +- **Attributes:** level, showCommentsCount, showPostTitle, textAlign ## Cover Add an image or video with a text overlay. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/cover)) -- **Name:** core/cover -- **Category:** media -- **Supports:** align, anchor, color (heading, text, ~~background~~), layout (~~allowJustification~~), spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** allowedBlocks, alt, backgroundType, contentPosition, customGradient, customOverlayColor, dimRatio, focalPoint, gradient, hasParallax, id, isDark, isRepeated, minHeight, minHeightUnit, overlayColor, tagName, templateLock, url, useFeaturedImage +- **Name:** core/cover +- **Category:** media +- **Supports:** align, anchor, color (heading, text, ~~background~~), layout (~~allowJustification~~), spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** allowedBlocks, alt, backgroundType, contentPosition, customGradient, customOverlayColor, dimRatio, focalPoint, gradient, hasParallax, id, isDark, isRepeated, minHeight, minHeightUnit, overlayColor, tagName, templateLock, url, useFeaturedImage ## Details Hide and show additional content. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/details)) -- **Name:** core/details -- **Category:** text -- **Supports:** align (full, wide), color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** showContent, summary +- **Name:** core/details +- **Category:** text +- **Supports:** align (full, wide), color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** showContent, summary ## Embed Add a block that displays content pulled from other sites, like Twitter or YouTube. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/embed)) -- **Name:** core/embed -- **Category:** embed -- **Supports:** align, spacing (margin) -- **Attributes:** allowResponsive, caption, previewable, providerNameSlug, responsive, type, url +- **Name:** core/embed +- **Category:** embed +- **Supports:** align, spacing (margin) +- **Attributes:** allowResponsive, caption, previewable, providerNameSlug, responsive, type, url ## File Add a link to a downloadable file. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/file)) -- **Name:** core/file -- **Category:** media -- **Supports:** align, anchor, color (background, gradients, link, ~~text~~), interactivity -- **Attributes:** displayPreview, downloadButtonText, fileId, fileName, href, id, previewHeight, showDownloadButton, textLinkHref, textLinkTarget +- **Name:** core/file +- **Category:** media +- **Supports:** align, anchor, color (background, gradients, link, ~~text~~), interactivity +- **Attributes:** displayPreview, downloadButtonText, fileId, fileName, href, id, previewHeight, showDownloadButton, textLinkHref, textLinkTarget ## Footnotes -([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/footnotes)) + ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/footnotes)) - **Name:** core/footnotes - **Category:** text @@ -281,631 +281,631 @@ Add a link to a downloadable file. ([Source](https://github.com/WordPress/gutenb Use the classic WordPress editor. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/freeform)) -- **Name:** core/freeform -- **Category:** text -- **Supports:** ~~className~~, ~~customClassName~~, ~~reusable~~ -- **Attributes:** content +- **Name:** core/freeform +- **Category:** text +- **Supports:** ~~className~~, ~~customClassName~~, ~~reusable~~ +- **Attributes:** content ## Gallery Display multiple images in a rich gallery. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/gallery)) -- **Name:** core/gallery -- **Category:** media -- **Supports:** align, anchor, color (background, gradients, ~~text~~), layout (default, ~~allowEditing~~, ~~allowInheriting~~, ~~allowSwitching~~), spacing (blockGap, margin, padding), units (em, px, rem, vh, vw), ~~html~~ -- **Attributes:** allowResize, caption, columns, fixedHeight, ids, imageCrop, images, linkTarget, linkTo, shortCodeTransforms, sizeSlug +- **Name:** core/gallery +- **Category:** media +- **Supports:** align, anchor, color (background, gradients, ~~text~~), layout (default, ~~allowEditing~~, ~~allowInheriting~~, ~~allowSwitching~~), spacing (blockGap, margin, padding), units (em, px, rem, vh, vw), ~~html~~ +- **Attributes:** allowResize, caption, columns, fixedHeight, ids, imageCrop, images, linkTarget, linkTo, shortCodeTransforms, sizeSlug ## Group Gather blocks in a layout container. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/group)) -- **Name:** core/group -- **Category:** design -- **Supports:** align (full, wide), anchor, ariaLabel, color (background, gradients, heading, link, text), dimensions (minHeight), layout (allowSizingOnChildren), position (sticky), spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** allowedBlocks, tagName, templateLock +- **Name:** core/group +- **Category:** design +- **Supports:** align (full, wide), anchor, ariaLabel, color (background, gradients, heading, link, text), dimensions (minHeight), layout (allowSizingOnChildren), position (sticky), spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** allowedBlocks, tagName, templateLock ## Heading Introduce new sections and organize content to help visitors (and search engines) understand the structure of your content. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/heading)) -- **Name:** core/heading -- **Category:** text -- **Supports:** \_\_unstablePasteTextInline, align (full, wide), anchor, className, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight) -- **Attributes:** content, level, placeholder, textAlign +- **Name:** core/heading +- **Category:** text +- **Supports:** __unstablePasteTextInline, align (full, wide), anchor, className, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight) +- **Attributes:** content, level, placeholder, textAlign ## Home Link Create a link that always points to the homepage of the site. Usually not necessary if there is already a site title link present in the header. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/home-link)) -- **Name:** core/home-link -- **Category:** design -- **Parent:** core/navigation -- **Supports:** typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** label +- **Name:** core/home-link +- **Category:** design +- **Parent:** core/navigation +- **Supports:** typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** label ## Custom HTML Add custom HTML code and preview it as you edit. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/html)) -- **Name:** core/html -- **Category:** widgets -- **Supports:** ~~className~~, ~~customClassName~~, ~~html~~ -- **Attributes:** content +- **Name:** core/html +- **Category:** widgets +- **Supports:** ~~className~~, ~~customClassName~~, ~~html~~ +- **Attributes:** content ## Image Insert an image to make a visual statement. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/image)) -- **Name:** core/image -- **Category:** media -- **Supports:** anchor, behaviors (lightbox), color (~~background~~, ~~text~~), filter (duotone) -- **Attributes:** align, alt, aspectRatio, caption, height, href, id, linkClass, linkDestination, linkTarget, rel, scale, sizeSlug, title, url, width +- **Name:** core/image +- **Category:** media +- **Supports:** anchor, behaviors (lightbox), color (~~background~~, ~~text~~), filter (duotone) +- **Attributes:** align, alt, aspectRatio, caption, height, href, id, linkClass, linkDestination, linkTarget, rel, scale, sizeSlug, title, url, width ## Latest Comments Display a list of your most recent comments. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/latest-comments)) -- **Name:** core/latest-comments -- **Category:** widgets -- **Supports:** align, spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** commentsToShow, displayAvatar, displayDate, displayExcerpt +- **Name:** core/latest-comments +- **Category:** widgets +- **Supports:** align, spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** commentsToShow, displayAvatar, displayDate, displayExcerpt ## Latest Posts Display a list of your most recent posts. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/latest-posts)) -- **Name:** core/latest-posts -- **Category:** widgets -- **Supports:** align, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** addLinkToFeaturedImage, categories, columns, displayAuthor, displayFeaturedImage, displayPostContent, displayPostContentRadio, displayPostDate, excerptLength, featuredImageAlign, featuredImageSizeHeight, featuredImageSizeSlug, featuredImageSizeWidth, order, orderBy, postLayout, postsToShow, selectedAuthor +- **Name:** core/latest-posts +- **Category:** widgets +- **Supports:** align, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** addLinkToFeaturedImage, categories, columns, displayAuthor, displayFeaturedImage, displayPostContent, displayPostContentRadio, displayPostDate, excerptLength, featuredImageAlign, featuredImageSizeHeight, featuredImageSizeSlug, featuredImageSizeWidth, order, orderBy, postLayout, postsToShow, selectedAuthor ## List Create a bulleted or numbered list. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/list)) -- **Name:** core/list -- **Category:** text -- **Supports:** \_\_unstablePasteTextInline, anchor, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~className~~ -- **Attributes:** ordered, placeholder, reversed, start, type, values +- **Name:** core/list +- **Category:** text +- **Supports:** __unstablePasteTextInline, anchor, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~className~~ +- **Attributes:** ordered, placeholder, reversed, start, type, values ## List item Create a list item. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/list-item)) -- **Name:** core/list-item -- **Category:** text -- **Parent:** core/list -- **Supports:** typography (fontSize, lineHeight), ~~className~~ -- **Attributes:** content, placeholder +- **Name:** core/list-item +- **Category:** text +- **Parent:** core/list +- **Supports:** typography (fontSize, lineHeight), ~~className~~ +- **Attributes:** content, placeholder ## Login/out Show login & logout links. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/loginout)) -- **Name:** core/loginout -- **Category:** theme -- **Supports:** className, typography (fontSize, lineHeight) -- **Attributes:** displayLoginAsForm, redirectToCurrent +- **Name:** core/loginout +- **Category:** theme +- **Supports:** className, typography (fontSize, lineHeight) +- **Attributes:** displayLoginAsForm, redirectToCurrent ## Media & Text Set media and words side-by-side for a richer layout. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/media-text)) -- **Name:** core/media-text -- **Category:** media -- **Supports:** align (full, wide), anchor, color (background, gradients, heading, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** align, allowedBlocks, focalPoint, href, imageFill, isStackedOnMobile, linkClass, linkDestination, linkTarget, mediaAlt, mediaId, mediaLink, mediaPosition, mediaSizeSlug, mediaType, mediaUrl, mediaWidth, rel, verticalAlignment +- **Name:** core/media-text +- **Category:** media +- **Supports:** align (full, wide), anchor, color (background, gradients, heading, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** align, allowedBlocks, focalPoint, href, imageFill, isStackedOnMobile, linkClass, linkDestination, linkTarget, mediaAlt, mediaId, mediaLink, mediaPosition, mediaSizeSlug, mediaType, mediaUrl, mediaWidth, rel, verticalAlignment ## Unsupported Your site doesn’t include support for this block. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/missing)) -- **Name:** core/missing -- **Category:** text -- **Supports:** ~~className~~, ~~customClassName~~, ~~html~~, ~~inserter~~, ~~reusable~~ -- **Attributes:** originalContent, originalName, originalUndelimitedContent +- **Name:** core/missing +- **Category:** text +- **Supports:** ~~className~~, ~~customClassName~~, ~~html~~, ~~inserter~~, ~~reusable~~ +- **Attributes:** originalContent, originalName, originalUndelimitedContent ## More Content before this block will be shown in the excerpt on your archives page. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/more)) -- **Name:** core/more -- **Category:** design -- **Supports:** ~~className~~, ~~customClassName~~, ~~html~~, ~~multiple~~ -- **Attributes:** customText, noTeaser +- **Name:** core/more +- **Category:** design +- **Supports:** ~~className~~, ~~customClassName~~, ~~html~~, ~~multiple~~ +- **Attributes:** customText, noTeaser ## Navigation A collection of blocks that allow visitors to get around your site. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/navigation)) -- **Name:** core/navigation -- **Category:** theme -- **Supports:** align (full, wide), inserter, interactivity, layout (allowSizingOnChildren, default, ~~allowInheriting~~, ~~allowSwitching~~, ~~allowVerticalAlignment~~), spacing (blockGap, units), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** \_\_unstableLocation, backgroundColor, customBackgroundColor, customOverlayBackgroundColor, customOverlayTextColor, customTextColor, hasIcon, icon, maxNestingLevel, openSubmenusOnClick, overlayBackgroundColor, overlayMenu, overlayTextColor, ref, rgbBackgroundColor, rgbTextColor, showSubmenuIcon, templateLock, textColor +- **Name:** core/navigation +- **Category:** theme +- **Supports:** align (full, wide), inserter, interactivity, layout (allowSizingOnChildren, default, ~~allowInheriting~~, ~~allowSwitching~~, ~~allowVerticalAlignment~~), spacing (blockGap, units), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** __unstableLocation, backgroundColor, customBackgroundColor, customOverlayBackgroundColor, customOverlayTextColor, customTextColor, hasIcon, icon, maxNestingLevel, openSubmenusOnClick, overlayBackgroundColor, overlayMenu, overlayTextColor, ref, rgbBackgroundColor, rgbTextColor, showSubmenuIcon, templateLock, textColor ## Custom Link Add a page, link, or another item to your navigation. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/navigation-link)) -- **Name:** core/navigation-link -- **Category:** design -- **Parent:** core/navigation -- **Supports:** typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** description, id, isTopLevelLink, kind, label, opensInNewTab, rel, title, type, url +- **Name:** core/navigation-link +- **Category:** design +- **Parent:** core/navigation +- **Supports:** typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** description, id, isTopLevelLink, kind, label, opensInNewTab, rel, title, type, url ## Submenu Add a submenu to your navigation. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/navigation-submenu)) -- **Name:** core/navigation-submenu -- **Category:** design -- **Parent:** core/navigation -- **Supports:** ~~html~~, ~~reusable~~ -- **Attributes:** description, id, isTopLevelItem, kind, label, opensInNewTab, rel, title, type, url +- **Name:** core/navigation-submenu +- **Category:** design +- **Parent:** core/navigation +- **Supports:** ~~html~~, ~~reusable~~ +- **Attributes:** description, id, isTopLevelItem, kind, label, opensInNewTab, rel, title, type, url ## Page Break Separate your content into a multi-page experience. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/nextpage)) -- **Name:** core/nextpage -- **Category:** design -- **Parent:** core/post-content -- **Supports:** ~~className~~, ~~customClassName~~, ~~html~~ -- **Attributes:** +- **Name:** core/nextpage +- **Category:** design +- **Parent:** core/post-content +- **Supports:** ~~className~~, ~~customClassName~~, ~~html~~ +- **Attributes:** ## Page List Display a list of all pages. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/page-list)) -- **Name:** core/page-list -- **Category:** widgets -- **Supports:** typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** isNested, parentPageID +- **Name:** core/page-list +- **Category:** widgets +- **Supports:** typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** isNested, parentPageID ## Page List Item Displays a page inside a list of all pages. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/page-list-item)) -- **Name:** core/page-list-item -- **Category:** widgets -- **Parent:** core/page-list -- **Supports:** ~~html~~, ~~inserter~~, ~~lock~~, ~~reusable~~ -- **Attributes:** hasChildren, id, label, link, title +- **Name:** core/page-list-item +- **Category:** widgets +- **Parent:** core/page-list +- **Supports:** ~~html~~, ~~inserter~~, ~~lock~~, ~~reusable~~ +- **Attributes:** hasChildren, id, label, link, title ## Paragraph Start with the basic building block of all narrative. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/paragraph)) -- **Name:** core/paragraph -- **Category:** text -- **Supports:** \_\_unstablePasteTextInline, anchor, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~className~~ -- **Attributes:** align, content, direction, dropCap, placeholder +- **Name:** core/paragraph +- **Category:** text +- **Supports:** __unstablePasteTextInline, anchor, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~className~~ +- **Attributes:** align, content, direction, dropCap, placeholder ## Pattern placeholder Show a block pattern. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/pattern)) -- **Name:** core/pattern -- **Category:** theme -- **Supports:** ~~html~~, ~~inserter~~ -- **Attributes:** slug +- **Name:** core/pattern +- **Category:** theme +- **Supports:** ~~html~~, ~~inserter~~ +- **Attributes:** slug ## Post Author Display post author details such as name, avatar, and bio. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-author)) -- **Name:** core/post-author -- **Category:** theme -- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** avatarSize, byline, isLink, linkTarget, showAvatar, showBio, textAlign +- **Name:** core/post-author +- **Category:** theme +- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** avatarSize, byline, isLink, linkTarget, showAvatar, showBio, textAlign ## Post Author Biography The author biography. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-author-biography)) -- **Name:** core/post-author-biography -- **Category:** theme -- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight) -- **Attributes:** textAlign +- **Name:** core/post-author-biography +- **Category:** theme +- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight) +- **Attributes:** textAlign ## Post Author Name The author name. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-author-name)) -- **Name:** core/post-author-name -- **Category:** theme -- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** isLink, linkTarget, textAlign +- **Name:** core/post-author-name +- **Category:** theme +- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** isLink, linkTarget, textAlign ## Post Comment (deprecated) This block is deprecated. Please use the Comments block instead. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-comment)) -- **Name:** core/post-comment -- **Experimental:** fse -- **Category:** theme -- **Supports:** ~~html~~, ~~inserter~~ -- **Attributes:** commentId +- **Name:** core/post-comment +- **Experimental:** fse +- **Category:** theme +- **Supports:** ~~html~~, ~~inserter~~ +- **Attributes:** commentId ## Post Comments Count Display a post's comments count. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-comments-count)) -- **Name:** core/post-comments-count -- **Experimental:** fse -- **Category:** theme -- **Supports:** color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** textAlign +- **Name:** core/post-comments-count +- **Experimental:** fse +- **Category:** theme +- **Supports:** color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** textAlign ## Post Comments Form Display a post's comments form. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-comments-form)) -- **Name:** core/post-comments-form -- **Category:** theme -- **Supports:** color (background, gradients, heading, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** textAlign +- **Name:** core/post-comments-form +- **Category:** theme +- **Supports:** color (background, gradients, heading, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** textAlign ## Post Comments Link Displays the link to the current post comments. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-comments-link)) -- **Name:** core/post-comments-link -- **Experimental:** fse -- **Category:** theme -- **Supports:** color (background, link, ~~text~~), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** textAlign +- **Name:** core/post-comments-link +- **Experimental:** fse +- **Category:** theme +- **Supports:** color (background, link, ~~text~~), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** textAlign ## Post Content Displays the contents of a post or page. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-content)) -- **Name:** core/post-content -- **Category:** theme -- **Supports:** align (full, wide), dimensions (minHeight), layout, typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** +- **Name:** core/post-content +- **Category:** theme +- **Supports:** align (full, wide), dimensions (minHeight), layout, typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** ## Post Date Add the date of this post. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-date)) -- **Name:** core/post-date -- **Category:** theme -- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** displayType, format, isLink, textAlign +- **Name:** core/post-date +- **Category:** theme +- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** displayType, format, isLink, textAlign ## Excerpt Display the excerpt. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-excerpt)) -- **Name:** core/post-excerpt -- **Category:** theme -- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** excerptLength, moreText, showMoreOnNewLine, textAlign +- **Name:** core/post-excerpt +- **Category:** theme +- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** excerptLength, moreText, showMoreOnNewLine, textAlign ## Post Featured Image Display a post's featured image. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-featured-image)) -- **Name:** core/post-featured-image -- **Category:** theme -- **Supports:** align (center, full, left, right, wide), color (~~background~~, ~~text~~), spacing (margin, padding), ~~html~~ -- **Attributes:** aspectRatio, customGradient, customOverlayColor, dimRatio, gradient, height, isLink, linkTarget, overlayColor, rel, scale, sizeSlug, width +- **Name:** core/post-featured-image +- **Category:** theme +- **Supports:** align (center, full, left, right, wide), color (~~background~~, ~~text~~), spacing (margin, padding), ~~html~~ +- **Attributes:** aspectRatio, customGradient, customOverlayColor, dimRatio, gradient, height, isLink, linkTarget, overlayColor, rel, scale, sizeSlug, width ## Post Navigation Link Displays the next or previous post link that is adjacent to the current post. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-navigation-link)) -- **Name:** core/post-navigation-link -- **Category:** theme -- **Supports:** anchor, color (background, link, text), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** arrow, excludedTerms, inSameTerm label, linkLabel, showTitle, taxonomy, textAlign, type +- **Name:** core/post-navigation-link +- **Category:** theme +- **Supports:** color (background, link, text), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** arrow, excludedTerms, inSameTerm, label, linkLabel, showTitle, taxonomy, textAlign, type ## Post Template Contains the block elements used to render a post, like the title, date, featured image, content or excerpt, and more. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-template)) -- **Name:** core/post-template -- **Category:** theme -- **Parent:** core/query -- **Supports:** align (full, wide), color (background, gradients, link, text), layout, spacing (blockGap), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** +- **Name:** core/post-template +- **Category:** theme +- **Parent:** core/query +- **Supports:** align (full, wide), color (background, gradients, link, text), layout, spacing (blockGap), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** ## Post Terms Post terms. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-terms)) -- **Name:** core/post-terms -- **Category:** theme -- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** prefix, separator, suffix, term, textAlign +- **Name:** core/post-terms +- **Category:** theme +- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** prefix, separator, suffix, term, textAlign ## Time To Read Show minutes required to finish reading the post. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-time-to-read)) -- **Name:** core/post-time-to-read -- **Experimental:** true -- **Category:** theme -- **Supports:** color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** textAlign +- **Name:** core/post-time-to-read +- **Experimental:** true +- **Category:** theme +- **Supports:** color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** textAlign ## Title Displays the title of a post, page, or any other content-type. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-title)) -- **Name:** core/post-title -- **Category:** theme -- **Supports:** align (full, wide), color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** isLink, level, linkTarget, rel, textAlign +- **Name:** core/post-title +- **Category:** theme +- **Supports:** align (full, wide), color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** isLink, level, linkTarget, rel, textAlign ## Preformatted Add text that respects your spacing and tabs, and also allows styling. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/preformatted)) -- **Name:** core/preformatted -- **Category:** text -- **Supports:** anchor, color (background, gradients, text), typography (fontSize, lineHeight) -- **Attributes:** content +- **Name:** core/preformatted +- **Category:** text +- **Supports:** anchor, color (background, gradients, text), typography (fontSize, lineHeight) +- **Attributes:** content ## Pullquote Give special visual emphasis to a quote from your text. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/pullquote)) -- **Name:** core/pullquote -- **Category:** text -- **Supports:** align (full, left, right, wide), anchor, color (background, gradients, link, text), typography (fontSize, lineHeight) -- **Attributes:** citation, textAlign, value +- **Name:** core/pullquote +- **Category:** text +- **Supports:** align (full, left, right, wide), anchor, color (background, gradients, link, text), typography (fontSize, lineHeight) +- **Attributes:** citation, textAlign, value ## Query Loop An advanced block that allows displaying post types based on different query parameters and visual configurations. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/query)) -- **Name:** core/query -- **Category:** theme -- **Supports:** align (full, wide), layout, ~~html~~ -- **Attributes:** namespace, query, queryId, tagName +- **Name:** core/query +- **Category:** theme +- **Supports:** align (full, wide), layout, ~~html~~ +- **Attributes:** namespace, query, queryId, tagName ## No results Contains the block elements used to render content when no query results are found. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/query-no-results)) -- **Name:** core/query-no-results -- **Category:** theme -- **Parent:** core/query -- **Supports:** align, color (background, gradients, link, text), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** +- **Name:** core/query-no-results +- **Category:** theme +- **Parent:** core/query +- **Supports:** align, color (background, gradients, link, text), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** ## Pagination Displays a paginated navigation to next/previous set of posts, when applicable. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/query-pagination)) -- **Name:** core/query-pagination -- **Category:** theme -- **Parent:** core/query -- **Supports:** align, color (background, gradients, link, text), layout (default, ~~allowInheriting~~, ~~allowSwitching~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** paginationArrow, showLabel +- **Name:** core/query-pagination +- **Category:** theme +- **Parent:** core/query +- **Supports:** align, color (background, gradients, link, text), layout (default, ~~allowInheriting~~, ~~allowSwitching~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** paginationArrow, showLabel ## Next Page Displays the next posts page link. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/query-pagination-next)) -- **Name:** core/query-pagination-next -- **Category:** theme -- **Parent:** core/query-pagination -- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** label +- **Name:** core/query-pagination-next +- **Category:** theme +- **Parent:** core/query-pagination +- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** label ## Page Numbers Displays a list of page numbers for pagination ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/query-pagination-numbers)) -- **Name:** core/query-pagination-numbers -- **Category:** theme -- **Parent:** core/query-pagination -- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** +- **Name:** core/query-pagination-numbers +- **Category:** theme +- **Parent:** core/query-pagination +- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** ## Previous Page Displays the previous posts page link. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/query-pagination-previous)) -- **Name:** core/query-pagination-previous -- **Category:** theme -- **Parent:** core/query-pagination -- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** label +- **Name:** core/query-pagination-previous +- **Category:** theme +- **Parent:** core/query-pagination +- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** label ## Query Title Display the query title. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/query-title)) -- **Name:** core/query-title -- **Category:** theme -- **Supports:** align (full, wide), color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** level, showPrefix, showSearchTerm, textAlign, type +- **Name:** core/query-title +- **Category:** theme +- **Supports:** align (full, wide), color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** level, showPrefix, showSearchTerm, textAlign, type ## Quote Give quoted text visual emphasis. "In quoting others, we cite ourselves." — Julio Cortázar ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/quote)) -- **Name:** core/quote -- **Category:** text -- **Supports:** anchor, color (background, gradients, heading, link, text), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** align, citation, value +- **Name:** core/quote +- **Category:** text +- **Supports:** anchor, color (background, gradients, heading, link, text), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** align, citation, value ## Read More Displays the link of a post, page, or any other content-type. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/read-more)) -- **Name:** core/read-more -- **Category:** theme -- **Supports:** color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** content, linkTarget +- **Name:** core/read-more +- **Category:** theme +- **Supports:** color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** content, linkTarget ## RSS Display entries from any RSS or Atom feed. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/rss)) -- **Name:** core/rss -- **Category:** widgets -- **Supports:** align, ~~html~~ -- **Attributes:** blockLayout, columns, displayAuthor, displayDate, displayExcerpt, excerptLength, feedURL, itemsToShow +- **Name:** core/rss +- **Category:** widgets +- **Supports:** align, ~~html~~ +- **Attributes:** blockLayout, columns, displayAuthor, displayDate, displayExcerpt, excerptLength, feedURL, itemsToShow ## Search Help visitors find your content. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/search)) -- **Name:** core/search -- **Category:** widgets -- **Supports:** align (center, left, right), color (background, gradients, text), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** buttonBehavior, buttonPosition, buttonText, buttonUseIcon, isSearchFieldHidden, label, placeholder, query, showLabel, width, widthUnit +- **Name:** core/search +- **Category:** widgets +- **Supports:** align (center, left, right), color (background, gradients, text), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** buttonBehavior, buttonPosition, buttonText, buttonUseIcon, isSearchFieldHidden, label, placeholder, query, showLabel, width, widthUnit ## Separator Create a break between ideas or sections with a horizontal separator. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/separator)) -- **Name:** core/separator -- **Category:** design -- **Supports:** align (center, full, wide), anchor, color (background, gradients, ~~enableContrastChecker~~, ~~text~~), spacing (margin) -- **Attributes:** opacity +- **Name:** core/separator +- **Category:** design +- **Supports:** align (center, full, wide), anchor, color (background, gradients, ~~enableContrastChecker~~, ~~text~~), spacing (margin) +- **Attributes:** opacity ## Shortcode Insert additional custom elements with a WordPress shortcode. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/shortcode)) -- **Name:** core/shortcode -- **Category:** widgets -- **Supports:** ~~className~~, ~~customClassName~~, ~~html~~ -- **Attributes:** text +- **Name:** core/shortcode +- **Category:** widgets +- **Supports:** ~~className~~, ~~customClassName~~, ~~html~~ +- **Attributes:** text ## Site Logo Display an image to represent this site. Update this block and the changes apply everywhere. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/site-logo)) -- **Name:** core/site-logo -- **Category:** theme -- **Supports:** align, color (~~background~~, ~~text~~), spacing (margin, padding), ~~alignWide~~, ~~html~~ -- **Attributes:** isLink, linkTarget, shouldSyncIcon, width +- **Name:** core/site-logo +- **Category:** theme +- **Supports:** align, color (~~background~~, ~~text~~), spacing (margin, padding), ~~alignWide~~, ~~html~~ +- **Attributes:** isLink, linkTarget, shouldSyncIcon, width ## Site Tagline Describe in a few words what the site is about. The tagline can be used in search results or when sharing on social networks even if it’s not displayed in the theme design. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/site-tagline)) -- **Name:** core/site-tagline -- **Category:** theme -- **Supports:** align (full, wide), color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** textAlign +- **Name:** core/site-tagline +- **Category:** theme +- **Supports:** align (full, wide), color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** textAlign ## Site Title Displays the name of this site. Update the block, and the changes apply everywhere it’s used. This will also appear in the browser title bar and in search results. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/site-title)) -- **Name:** core/site-title -- **Category:** theme -- **Supports:** align (full, wide), color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** isLink, level, linkTarget, textAlign +- **Name:** core/site-title +- **Category:** theme +- **Supports:** align (full, wide), color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** isLink, level, linkTarget, textAlign ## Social Icon Display an icon linking to a social media profile or site. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/social-link)) -- **Name:** core/social-link -- **Category:** widgets -- **Parent:** core/social-links -- **Supports:** ~~html~~, ~~reusable~~ -- **Attributes:** label, rel, service, url +- **Name:** core/social-link +- **Category:** widgets +- **Parent:** core/social-links +- **Supports:** ~~html~~, ~~reusable~~ +- **Attributes:** label, rel, service, url ## Social Icons Display icons linking to your social media profiles or sites. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/social-links)) -- **Name:** core/social-links -- **Category:** widgets -- **Supports:** align (center, left, right), anchor, color (background, gradients, ~~enableContrastChecker~~, ~~text~~), layout (default, ~~allowInheriting~~, ~~allowSwitching~~, ~~allowVerticalAlignment~~), spacing (blockGap, margin, padding, units) -- **Attributes:** customIconBackgroundColor, customIconColor, iconBackgroundColor, iconBackgroundColorValue, iconColor, iconColorValue, openInNewTab, showLabels, size +- **Name:** core/social-links +- **Category:** widgets +- **Supports:** align (center, left, right), anchor, color (background, gradients, ~~enableContrastChecker~~, ~~text~~), layout (default, ~~allowInheriting~~, ~~allowSwitching~~, ~~allowVerticalAlignment~~), spacing (blockGap, margin, padding, units) +- **Attributes:** customIconBackgroundColor, customIconColor, iconBackgroundColor, iconBackgroundColorValue, iconColor, iconColorValue, openInNewTab, showLabels, size ## Spacer Add white space between blocks and customize its height. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/spacer)) -- **Name:** core/spacer -- **Category:** design -- **Supports:** anchor, spacing (margin) -- **Attributes:** height, width +- **Name:** core/spacer +- **Category:** design +- **Supports:** anchor, spacing (margin) +- **Attributes:** height, width ## Table Create structured content in rows and columns to display information. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/table)) -- **Name:** core/table -- **Category:** text -- **Supports:** align, anchor, color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight) -- **Attributes:** body, caption, foot, hasFixedLayout, head +- **Name:** core/table +- **Category:** text +- **Supports:** align, anchor, color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight) +- **Attributes:** body, caption, foot, hasFixedLayout, head ## Table of Contents Summarize your post with a list of headings. Add HTML anchors to Heading blocks to link them here. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/table-of-contents)) -- **Name:** core/table-of-contents -- **Experimental:** true -- **Category:** layout -- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** headings, onlyIncludeCurrentPage +- **Name:** core/table-of-contents +- **Experimental:** true +- **Category:** layout +- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** headings, onlyIncludeCurrentPage ## Tag Cloud A cloud of your most used tags. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/tag-cloud)) -- **Name:** core/tag-cloud -- **Category:** widgets -- **Supports:** align, spacing (margin, padding), typography (lineHeight), ~~html~~ -- **Attributes:** largestFontSize, numberOfTags, showTagCounts, smallestFontSize, taxonomy +- **Name:** core/tag-cloud +- **Category:** widgets +- **Supports:** align, spacing (margin, padding), typography (lineHeight), ~~html~~ +- **Attributes:** largestFontSize, numberOfTags, showTagCounts, smallestFontSize, taxonomy ## Template Part Edit the different global regions of your site, like the header, footer, sidebar, or create your own. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/template-part)) -- **Name:** core/template-part -- **Category:** theme -- **Supports:** align, ~~html~~, ~~reusable~~ -- **Attributes:** area, slug, tagName, theme +- **Name:** core/template-part +- **Category:** theme +- **Supports:** align, ~~html~~, ~~reusable~~ +- **Attributes:** area, slug, tagName, theme ## Term Description Display the description of categories, tags and custom taxonomies when viewing an archive. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/term-description)) -- **Name:** core/term-description -- **Experimental:** fse -- **Category:** theme -- **Supports:** align (full, wide), color (background, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** textAlign +- **Name:** core/term-description +- **Experimental:** fse +- **Category:** theme +- **Supports:** align (full, wide), color (background, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** textAlign ## Text Columns (deprecated) This block is deprecated. Please use the Columns block instead. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/text-columns)) -- **Name:** core/text-columns -- **Category:** design -- **Supports:** ~~inserter~~ -- **Attributes:** columns, content, width +- **Name:** core/text-columns +- **Category:** design +- **Supports:** ~~inserter~~ +- **Attributes:** columns, content, width ## Verse Insert poetry. Use special spacing formats. Or quote song lyrics. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/verse)) -- **Name:** core/verse -- **Category:** text -- **Supports:** anchor, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight) -- **Attributes:** content, textAlign +- **Name:** core/verse +- **Category:** text +- **Supports:** anchor, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight) +- **Attributes:** content, textAlign ## Video Embed a video from your media library or upload a new one. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/video)) -- **Name:** core/video -- **Category:** media -- **Supports:** align, anchor, spacing (margin, padding) -- **Attributes:** autoplay, caption, controls, id, loop, muted, playsInline, poster, preload, src, tracks +- **Name:** core/video +- **Category:** media +- **Supports:** align, anchor, spacing (margin, padding) +- **Attributes:** autoplay, caption, controls, id, loop, muted, playsInline, poster, preload, src, tracks From d5cd37941342ab3fd37a484d095aca2e49fd89ad Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Fri, 21 Jul 2023 12:43:37 +0200 Subject: [PATCH 09/17] Remove the taxonomy filter toggle and update the PHP conditions. --- .../src/post-navigation-link/block.json | 2 +- .../src/post-navigation-link/edit.js | 27 +++++++------------ .../src/post-navigation-link/index.php | 16 ++++++----- 3 files changed, 21 insertions(+), 24 deletions(-) diff --git a/packages/block-library/src/post-navigation-link/block.json b/packages/block-library/src/post-navigation-link/block.json index 5a71c477820bb6..ea0d00f16c88c2 100644 --- a/packages/block-library/src/post-navigation-link/block.json +++ b/packages/block-library/src/post-navigation-link/block.json @@ -37,7 +37,7 @@ }, "taxonomy": { "type": "string", - "default": "category" + "default": "" } }, "supports": { diff --git a/packages/block-library/src/post-navigation-link/edit.js b/packages/block-library/src/post-navigation-link/edit.js index b4b11ce5a2aa7f..5ed5758d67520a 100644 --- a/packages/block-library/src/post-navigation-link/edit.js +++ b/packages/block-library/src/post-navigation-link/edit.js @@ -33,7 +33,6 @@ export default function PostNavigationLinkEdit( { textAlign, linkLabel, arrow, - inSameTerm, taxonomy, excludedTerms, }, @@ -84,9 +83,8 @@ export default function PostNavigationLinkEdit( { ); const getTaxonomyOptions = () => { const selectOption = { - label: __( '- Select -' ), + label: __( 'Unfiltered' ), value: '', - disabled: true, }; const taxonomyOptions = ( taxonomies ?? [] ) .filter( ( tax ) => tax.slug !== 'nav_menu' ) @@ -167,25 +165,20 @@ export default function PostNavigationLinkEdit( { - + value={ taxonomy } + options={ getTaxonomyOptions() } + onChange={ ( value ) => setAttributes( { - inSameTerm: ! inSameTerm, + taxonomy: value, + inSameTerm: value === '' ? false : true, } ) } + help={ __( + 'Only link to posts that have the same taxonomy terms as the current post. For example the same categories.' + ) } /> - { inSameTerm && ( - - setAttributes( { taxonomy: value } ) - } - /> - ) } term_taxonomy_id; } @@ -121,9 +122,12 @@ function render_block_core_post_navigation_link( $attributes, $content ) { } } $excluded_terms = array_unique( $result ); - $content = $get_link_function( $format, $link, $in_same_term, $excluded_terms, $taxonomy ); + } + + if ( $in_same_term ) { + $content = $get_link_function( $format, $link, $in_same_term, $excluded_terms, $taxonomy ); } else { - $content = $get_link_function( $format, $link, $in_same_term, $taxonomy ); + $content = $get_link_function( $format, $link, '', $excluded_terms ); } return sprintf( From 92792066b202f9f95fbf2f021284169b8344f75c Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Fri, 21 Jul 2023 13:05:09 +0200 Subject: [PATCH 10/17] Update core__post-navigation-link.json --- .../integration/fixtures/blocks/core__post-navigation-link.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/fixtures/blocks/core__post-navigation-link.json b/test/integration/fixtures/blocks/core__post-navigation-link.json index 081ccbedfadc7a..b226c04855e359 100644 --- a/test/integration/fixtures/blocks/core__post-navigation-link.json +++ b/test/integration/fixtures/blocks/core__post-navigation-link.json @@ -7,7 +7,7 @@ "showTitle": false, "linkLabel": false, "arrow": "none", - "taxonomy": "category" + "taxonomy": "" }, "innerBlocks": [] } From 9e215f089a826acfd74b56372a8a5077baf10f21 Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Fri, 11 Aug 2023 11:16:46 +0200 Subject: [PATCH 11/17] Update help text about excluding terms --- packages/block-library/src/post-navigation-link/edit.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/block-library/src/post-navigation-link/edit.js b/packages/block-library/src/post-navigation-link/edit.js index 5ed5758d67520a..e41ab5f2112a22 100644 --- a/packages/block-library/src/post-navigation-link/edit.js +++ b/packages/block-library/src/post-navigation-link/edit.js @@ -181,11 +181,13 @@ export default function PostNavigationLinkEdit( { /> setAttributes( { excludedTerms: value } ) } + help={ __( + 'Exclude terms from any taxonomy by entering the term name. Separate multiple terms with a comma.' + ) } /> From 80f5a959a60cca921d90c6f1fe647546b8332781 Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Fri, 11 Aug 2023 13:03:32 +0200 Subject: [PATCH 12/17] Update help text again. --- packages/block-library/src/post-navigation-link/edit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/post-navigation-link/edit.js b/packages/block-library/src/post-navigation-link/edit.js index e41ab5f2112a22..69dbc340d6fef0 100644 --- a/packages/block-library/src/post-navigation-link/edit.js +++ b/packages/block-library/src/post-navigation-link/edit.js @@ -186,7 +186,7 @@ export default function PostNavigationLinkEdit( { setAttributes( { excludedTerms: value } ) } help={ __( - 'Exclude terms from any taxonomy by entering the term name. Separate multiple terms with a comma.' + 'Exclude terms from any taxonomy by entering the term name, slug, or ID. Separate multiple terms with a comma. Posts with excluded terms will not be linked to, even if they have other matching terms.' ) } /> From bf28bdac2d147e0e52db2e2bb44ac6075bde60fe Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Mon, 6 Nov 2023 06:25:40 +0100 Subject: [PATCH 13/17] Remove the exclude terms feature, move filter to advanced panel --- .../src/post-navigation-link/block.json | 3 -- .../src/post-navigation-link/edit.js | 44 +++++++------------ .../src/post-navigation-link/index.php | 28 ++---------- 3 files changed, 19 insertions(+), 56 deletions(-) diff --git a/packages/block-library/src/post-navigation-link/block.json b/packages/block-library/src/post-navigation-link/block.json index ea0d00f16c88c2..13c7e775c76737 100644 --- a/packages/block-library/src/post-navigation-link/block.json +++ b/packages/block-library/src/post-navigation-link/block.json @@ -29,9 +29,6 @@ "type": "string", "default": "none" }, - "excludedTerms": { - "type": "string" - }, "inSameTerm": { "type": "boolean" }, diff --git a/packages/block-library/src/post-navigation-link/edit.js b/packages/block-library/src/post-navigation-link/edit.js index 69dbc340d6fef0..7c200ad7e48a07 100644 --- a/packages/block-library/src/post-navigation-link/edit.js +++ b/packages/block-library/src/post-navigation-link/edit.js @@ -12,7 +12,6 @@ import { ToggleControl, SelectControl, PanelBody, - __experimentalInputControl as InputControl, } from '@wordpress/components'; import { InspectorControls, @@ -34,7 +33,6 @@ export default function PostNavigationLinkEdit( { linkLabel, arrow, taxonomy, - excludedTerms, }, setAttributes, } ) { @@ -164,32 +162,22 @@ export default function PostNavigationLinkEdit( { /> - - - setAttributes( { - taxonomy: value, - inSameTerm: value === '' ? false : true, - } ) - } - help={ __( - 'Only link to posts that have the same taxonomy terms as the current post. For example the same categories.' - ) } - /> - - setAttributes( { excludedTerms: value } ) - } - help={ __( - 'Exclude terms from any taxonomy by entering the term name, slug, or ID. Separate multiple terms with a comma. Posts with excluded terms will not be linked to, even if they have other matching terms.' - ) } - /> - + + + + setAttributes( { + taxonomy: value, + inSameTerm: value === '' ? false : true, + } ) + } + help={ __( + 'Only link to posts that have the same taxonomy terms as the current post. For example the same tags or categories.' + ) } + /> term_taxonomy_id; - } - } - } - } - $excluded_terms = array_unique( $result ); - } - if ( $in_same_term ) { - $content = $get_link_function( $format, $link, $in_same_term, $excluded_terms, $taxonomy ); + $content = $get_link_function( $format, $link, $in_same_term, '', $taxonomy ); } else { - $content = $get_link_function( $format, $link, '', $excluded_terms ); + $content = $get_link_function( $format, $link ); } return sprintf( From a0f1da9045297d183b438f3a61ff34b9fe6ac7a0 Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Mon, 6 Nov 2023 06:59:00 +0100 Subject: [PATCH 14/17] Try to fix CS issues --- .../src/post-navigation-link/index.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/block-library/src/post-navigation-link/index.php b/packages/block-library/src/post-navigation-link/index.php index c5af5d4a75f8c8..5f13657e84a094 100644 --- a/packages/block-library/src/post-navigation-link/index.php +++ b/packages/block-library/src/post-navigation-link/index.php @@ -99,12 +99,15 @@ function render_block_core_post_navigation_link( $attributes, $content ) { } } - $in_same_term = isset( $attributes['inSameTerm'] ) ? $attributes['inSameTerm'] : false; - $taxonomy = isset( $attributes['taxonomy'] ) && $in_same_term ? $attributes['taxonomy'] : ''; + $in_same_term = isset( $attributes['inSameTerm'] ) ? $attributes['inSameTerm'] : false; + $taxonomy = isset( $attributes['taxonomy'] ) && $in_same_term ? $attributes['taxonomy'] : ''; - // The dynamic portion of the function name, `$navigation_type`, - // refers to the type of adjacency, 'next' or 'previous'. - // @See https://developer.wordpress.org/reference/functions/get_previous_post_link/ + /** + * The dynamic portion of the function name, `$navigation_type`, + * Refers to the type of adjacency, 'next' or 'previous'. + * @See https://developer.wordpress.org/reference/functions/get_previous_post_link/ + * @See https://developer.wordpress.org/reference/functions/get_next_post_link/ + */ $get_link_function = "get_{$navigation_type}_post_link"; if ( $in_same_term ) { From 6f7336264f3d6c50aeae7b07d2626daacb905f20 Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Mon, 6 Nov 2023 07:15:34 +0100 Subject: [PATCH 15/17] Update docs --- docs/reference-guides/core-blocks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index 3e558378734c11..c3f76dfcac7a9f 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -642,7 +642,7 @@ Displays the next or previous post link that is adjacent to the current post. ([ - **Name:** core/post-navigation-link - **Category:** theme - **Supports:** color (background, link, text), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** arrow, excludedTerms, inSameTerm, label, linkLabel, showTitle, taxonomy, textAlign, type +- **Attributes:** arrow, inSameTerm, label, linkLabel, showTitle, taxonomy, textAlign, type ## Post Template From c94aecb4b0d5c3835756cbafee6ec053c7e606c0 Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Mon, 6 Nov 2023 07:24:29 +0100 Subject: [PATCH 16/17] Try to fix CS issues --- packages/block-library/src/post-navigation-link/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/block-library/src/post-navigation-link/index.php b/packages/block-library/src/post-navigation-link/index.php index 5f13657e84a094..50106bdd7cce51 100644 --- a/packages/block-library/src/post-navigation-link/index.php +++ b/packages/block-library/src/post-navigation-link/index.php @@ -105,6 +105,7 @@ function render_block_core_post_navigation_link( $attributes, $content ) { /** * The dynamic portion of the function name, `$navigation_type`, * Refers to the type of adjacency, 'next' or 'previous'. + * * @See https://developer.wordpress.org/reference/functions/get_previous_post_link/ * @See https://developer.wordpress.org/reference/functions/get_next_post_link/ */ From 54a58bb9a10c287ee3cf86c6004705f25d3d4ce9 Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Mon, 6 Nov 2023 13:21:35 +0100 Subject: [PATCH 17/17] Use context to get the postType --- .../src/post-navigation-link/block.json | 1 + .../src/post-navigation-link/edit.js | 15 ++++++--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/block-library/src/post-navigation-link/block.json b/packages/block-library/src/post-navigation-link/block.json index 13c7e775c76737..61d42f0e55f201 100644 --- a/packages/block-library/src/post-navigation-link/block.json +++ b/packages/block-library/src/post-navigation-link/block.json @@ -37,6 +37,7 @@ "default": "" } }, + "usesContext": [ "postType" ], "supports": { "reusable": false, "html": false, diff --git a/packages/block-library/src/post-navigation-link/edit.js b/packages/block-library/src/post-navigation-link/edit.js index 7c200ad7e48a07..464531f9d45461 100644 --- a/packages/block-library/src/post-navigation-link/edit.js +++ b/packages/block-library/src/post-navigation-link/edit.js @@ -25,6 +25,7 @@ import { useSelect } from '@wordpress/data'; import { store as coreStore } from '@wordpress/core-data'; export default function PostNavigationLinkEdit( { + context: { postType }, attributes: { type, label, @@ -59,14 +60,6 @@ export default function PostNavigationLinkEdit( { } ), } ); - // We need to know the post type in order to get all supported taxonomies. - const postType = useSelect( - // FIXME: @wordpress/block-library should not depend on @wordpress/editor. - // Blocks can be loaded into a *non-post* block editor. - // eslint-disable-next-line @wordpress/data-no-store-string-literals - ( select ) => select( 'core/editor' ).getCurrentPostType(), - [] - ); const taxonomies = useSelect( ( select ) => { const { getTaxonomies } = select( coreStore ); @@ -85,7 +78,11 @@ export default function PostNavigationLinkEdit( { value: '', }; const taxonomyOptions = ( taxonomies ?? [] ) - .filter( ( tax ) => tax.slug !== 'nav_menu' ) + .filter( + ( tax ) => + tax.slug !== 'nav_menu' && + tax.slug !== 'wp_pattern_category' + ) .map( ( item ) => { return { value: item.slug,