Skip to content

Commit

Permalink
rename to read more
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras committed Jan 25, 2022
1 parent b28c202 commit 7683580
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 32 deletions.
18 changes: 9 additions & 9 deletions docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -530,15 +530,6 @@ Display a post's featured image. ([Source](https://github.com/WordPress/gutenber
- **Supports:** align (center, full, left, right, wide), color (~~background~~, ~~text~~), spacing (margin, padding), ~~html~~
- **Attributes:** height, isLink, scale, sizeSlug, width

## Post Link

Add the link of this post.

- **Name:** core/post-link
- **Category:** theme
- **Supports:** color (background, gradients, ~~text~~), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~
- **Attributes:** content, linkTarget

## 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))
Expand Down Expand Up @@ -656,6 +647,15 @@ Give quoted text visual emphasis. "In quoting others, we cite ourselves." — Ju
- **Supports:** anchor, typography (fontSize, lineHeight)
- **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

## RSS

Display entries from any RSS or Atom feed. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/rss))
Expand Down
2 changes: 1 addition & 1 deletion lib/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ function gutenberg_reregister_core_block_types() {
'post-date.php' => 'core/post-date',
'post-excerpt.php' => 'core/post-excerpt',
'post-featured-image.php' => 'core/post-featured-image',
'post-link.php' => 'core/post-link',
'post-navigation-link.php' => 'core/post-navigation-link',
'post-terms.php' => 'core/post-terms',
'post-title.php' => 'core/post-title',
Expand All @@ -103,6 +102,7 @@ function gutenberg_reregister_core_block_types() {
'query-pagination-numbers.php' => 'core/query-pagination-numbers',
'query-pagination-previous.php' => 'core/query-pagination-previous',
'query-title.php' => 'core/query-title',
'read-more.php' => 'core/read-more',
'rss.php' => 'core/rss',
'search.php' => 'core/search',
'shortcode.php' => 'core/shortcode',
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ import * as postContent from './post-content';
import * as postDate from './post-date';
import * as postExcerpt from './post-excerpt';
import * as postFeaturedImage from './post-featured-image';
import * as postLink from './post-link';
import * as postNavigationLink from './post-navigation-link';
import * as postTemplate from './post-template';
import * as postTerms from './post-terms';
Expand All @@ -84,6 +83,7 @@ import * as queryPaginationPrevious from './query-pagination-previous';
import * as queryTitle from './query-title';
import * as quote from './quote';
import * as reusableBlock from './block';
import * as readMore from './read-more';
import * as rss from './rss';
import * as search from './search';
import * as separator from './separator';
Expand Down Expand Up @@ -194,14 +194,14 @@ export const __experimentalGetCoreBlocks = () => [
postAuthor,
postDate,
postTerms,
postLink,
postNavigationLink,
postTemplate,
queryPagination,
queryPaginationNext,
queryPaginationNumbers,
queryPaginationPrevious,
postComments,
readMore,
logInOut,
termDescription,
queryTitle,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "core/post-link",
"title": "Post Link",
"name": "core/read-more",
"title": "Read More",
"category": "theme",
"description": "Add the link of this post.",
"keywords": [ "read more" ],
"description": "Displays the link of a post, page, or any other content-type.",
"textdomain": "default",
"attributes": {
"content": {
Expand Down Expand Up @@ -53,5 +52,5 @@
}
}
},
"style": "wp-block-post-link"
"style": "wp-block-read-more"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ToggleControl, PanelBody } from '@wordpress/components';
import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
import { __ } from '@wordpress/i18n';

export default function PostLink( {
export default function ReadMore( {
attributes: { content, linkTarget },
setAttributes,
insertBlocksAfter,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?php
/**
* Server-side rendering of the `core/post-link` block.
* Server-side rendering of the `core/read-more` block.
*
* @package WordPress
*/

/**
* Renders the `core/post-link` block on the server.
* Renders the `core/read-more` block on the server.
*
* @param array $attributes Block attributes.
* @param string $content Block default content.
* @param WP_Block $block Block instance.
* @return string Returns the post link.
*/
function render_block_core_post_link( $attributes, $content, $block ) {
function render_block_core_read_more( $attributes, $content, $block ) {
if ( ! isset( $block->context['postId'] ) ) {
return '';
}
Expand All @@ -32,14 +32,14 @@ function render_block_core_post_link( $attributes, $content, $block ) {
}

/**
* Registers the `core/post-link` block on the server.
* Registers the `core/read-more` block on the server.
*/
function register_block_core_post_link() {
function register_block_core_read_more() {
register_block_type_from_metadata(
__DIR__ . '/post-link',
__DIR__ . '/read-more',
array(
'render_callback' => 'render_block_core_post_link',
'render_callback' => 'render_block_core_read_more',
)
);
}
add_action( 'init', 'register_block_core_post_link' );
add_action( 'init', 'register_block_core_read_more' );
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.wp-block-post-link {
.wp-block-read-more {
display: block;
width: fit-content;
&:not([style*="text-decoration"]) {
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
@import "./post-comments-form/style.scss";
@import "./post-excerpt/style.scss";
@import "./post-featured-image/style.scss";
@import "./post-link/style.scss";
@import "./post-terms/style.scss";
@import "./post-title/style.scss";
@import "./preformatted/style.scss";
@import "./pullquote/style.scss";
@import "./post-template/style.scss";
@import "./query-pagination/style.scss";
@import "./quote/style.scss";
@import "./read-more/style.scss";
@import "./rss/style.scss";
@import "./search/style.scss";
@import "./separator/style.scss";
Expand Down
1 change: 0 additions & 1 deletion test/integration/fixtures/blocks/core__post-link.html

This file was deleted.

This file was deleted.

1 change: 1 addition & 0 deletions test/integration/fixtures/blocks/core__read-more.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- wp:read-more /-->
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"clientId": "_clientId_0",
"name": "core/post-link",
"name": "core/read-more",
"isValid": true,
"attributes": {
"linkTarget": "_self"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"blockName": "core/post-link",
"blockName": "core/read-more",
"attrs": {},
"innerBlocks": [],
"innerHTML": "",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- wp:read-more /-->

0 comments on commit 7683580

Please sign in to comment.