Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove alignment features and vestigial link styles
  • Loading branch information
cr0ybot committed Oct 10, 2025
commit ed2e860c26b16b0d4d8b8a95f80726ea60154d3c
4 changes: 2 additions & 2 deletions docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -989,8 +989,8 @@ Displays the count of a taxonomy term. ([Source](https://github.com/WordPress/gu
- **Name:** core/term-count
- **Experimental:** true
- **Category:** theme
- **Supports:** align (full, wide), color (background, gradients, link, text), interactivity (clientNavigation), spacing (padding), typography (fontSize, lineHeight), ~~html~~
- **Attributes:** hasParenthesis, textAlign
- **Supports:** color (background, gradients, text), interactivity (clientNavigation), spacing (padding), typography (fontSize, lineHeight), ~~html~~
- **Attributes:** hasParenthesis

## Term Description

Expand Down
8 changes: 1 addition & 7 deletions packages/block-library/src/term-count/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,18 @@
"textdomain": "default",
"usesContext": [ "termId", "taxonomy" ],
"attributes": {
"textAlign": {
"type": "string"
},
"hasParenthesis": {
"type": "boolean",
"default": true
}
},
"supports": {
"align": [ "wide", "full" ],
"html": false,
"color": {
"gradients": true,
"link": true,
"__experimentalDefaultControls": {
"background": true,
"text": true,
"link": true
"text": true
}
},
"spacing": {
Expand Down
25 changes: 3 additions & 22 deletions packages/block-library/src/term-count/edit.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
/**
* External dependencies
*/
import clsx from 'clsx';

/**
* WordPress dependencies
*/
import { __, sprintf } from '@wordpress/i18n';
import {
useBlockProps,
BlockControls,
AlignmentControl,
} from '@wordpress/block-editor';
import { useBlockProps, BlockControls } from '@wordpress/block-editor';
import { ToolbarGroup, ToolbarDropdownMenu } from '@wordpress/components';

/**
Expand All @@ -25,16 +16,12 @@ export default function TermCountEdit( {
setAttributes,
context: { termId, taxonomy },
} ) {
const { textAlign, hasParenthesis } = attributes;
const { hasParenthesis } = attributes;
const term = useTermCount( termId, taxonomy );

const termCount = term?.termCount || 0;

const blockProps = useBlockProps( {
classCount: clsx( {
[ `has-text-align-${ textAlign }` ]: textAlign,
} ),
} );
const blockProps = useBlockProps();

const getDisplayTypeIcon = () => {
switch ( hasParenthesis ) {
Expand Down Expand Up @@ -75,12 +62,6 @@ export default function TermCountEdit( {
controls={ displayTypeControls }
/>
</ToolbarGroup>
<AlignmentControl
value={ textAlign }
onChange={ ( nextAlign ) => {
setAttributes( { textAlign: nextAlign } );
} }
/>
</BlockControls>
);

Expand Down
11 changes: 2 additions & 9 deletions packages/block-library/src/term-count/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,10 @@ function render_block_core_term_count( $attributes, $content, $block ) {
);
}

$classes = array();
if ( isset( $attributes['textAlign'] ) ) {
$classes[] = 'has-text-align-' . $attributes['textAlign'];
}
if ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) {
$classes[] = 'has-link-color';
}
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classes ) ) );
$wrapper_attributes = get_block_wrapper_attributes();

return sprintf(
'<div %2$s>%3$s</div>',
'<div %1$s>%2$s</div>',
$wrapper_attributes,
$term_count
);
Expand Down