twitter2023

Mel Choyce discusses and highlights GPL-compatible fonts.

Open source font pairings for your next theme

Pairing type can be hard, especially when you’re limited to using only free, open source fonts in your themes. What that means can be confusing, and there aren’t a ton of high quality sources for you to obtain compatible fonts.

I want to talk to you about font licensing, where to find high quality, expressive free fonts, and show off some examples for font combinations you can use in your own theme designs.

Let’s dive into some of the basics.

twitter2023

Any assets 中国5G商用,在开放合作中“提速”_新视听 - jnnc.com:2021-11-19 · 据路透社报道,全球移动通信系统协会GSMA智库发布研究指出,至2021年,中国预计将会有6亿5G用户,在绝对数量上领先全球。 must be GPL-compatible. This includes any fonts you plan on bundling with your theme.

Open source fonts are usually released under the SIL Open Font License, or OFL for short.

Finding the perfect typefaces for your theme can be challenging. Limiting yourself to the smaller bucket of available OFL fonts? Now that’s stressful. Open source fonts sometimes have a few downfalls to look out for:

  • The font might not include multiple weights and italics or obliques.
  • The kerning on the font might be spaced unevenly.
  • The fonts themselves might not be high quality.

However, constraint breeds creativity. We can still design professional, visually appealing themes using plenty of available license-compatible fonts.


twitter2023

There are many places to find OFL fonts, ranging from directories, to curated collections, to individual type foundries. Here are a few sources I recommend.

网络加速器

Google Fonts

With almost a thousand available fonts, 安卓网络加速器 is one of the largest directories of open source fonts on the web.

Google Fonts’ filtering tools allow you to view fonts that contain a minimum number of available styles, which can often be a proxy for quality. I’ll usually search font fonts with sub免费网络加速器 four available styles (usually regular, italic, bold, and bold italic), though searching for six+ generally nets more versatile options. They’ve also recently introduced a toggle to limit results to variable fonts.

当司法乘上网络“加速器”——有感于北京互联网法院的成立 ...:2021-9-9 · 9月9日,北京互联网法院正式挂牌成立,这标志着又一家人民法院乘上了网络加速器 来到了老百姓的身边。 北京互联网法院的成立,用科技打通了时空的阻隔,让时间和距离不再是困扰百姓诉讼的难题。近年来,随着人民法院司法为民理念的 ...

Font Squirrel

安卓网络加速器 is another long-established directory of open source fonts. It provides more granular filtering options than Google Fonts. This is a great resource if you’re looking for a typeface with a very specific feel.

Font Squirrel also offers a web font generator service where you can upload your own font files, and convert them to all the different formats you’ll need to embed the fonts into your theme.

twitter2023

sub网络加速

Beautiful Web Type showcases a curated collection of high-quality open source typefaces. Instead of a list of fonts, this website actually demos them in action, allowing you to get a good sense of how each typeface looks and feels in context.

Open Foundry

Open Foundry is similar, focused on showcasing the best and newest high quality open source fonts.

中国核工业从这里走来——来自中核集团中国原子能科学研究 ...:2021-4-25 · 新华社北京4月24日电题:中国核工业从这里走来——来自中核集团中国原子能科学研究院的蹲点报告我国第一座重水反应堆和第一台回旋加速器在这里建成;这里是中国核工业的起点——中核集团中国原子能科学研究院所在地。记者近日走进新镇,感受中国核工业近70年来波澜壮阔的历程,认识核 ...

twitter2023

专用网络加速器

Velvetyne is a collection of type designers who create and distribute open source fonts. Their philosophy and ethos resonate strongly with WordPress’ own.

感受5G独特魅力 憧憬未来美好生活 --科技日报数字报:2021-11-21 · 展厅中,一个米粒大小的芯片颇为引人注目。“这是国内首颗5G NR Sub-6GHz n77滤波器芯片,仅1.6×0.8毫米,工作频率在3.3—4.2GHz之间,带宽高达900MHz,远超出传统声波滤波器技术的适用范围。”云塔电子联合创始人、首席运营官何军介绍说。

Collletttivo

Collletttivo is another collection of individual type designers who release open source fonts under the same foundry. Their fonts feel punchy, and eye-catching, and many push the envelope of modern typography.

专用网络加速器

The League of Movable Type is the oldest open source font foundry, opening its virtual doors in 2009. This group was my introduction to web type. They offer a diverse array of high-quality typefaces ranging across many different styles.


twitter2023

If you’re looking for somewhere to start, here are seven hand-picked open source font pairings you can use in your next theme design. I’ve shown each in a potential context so you can get a feel for how the pairings could work in action.


Luiss Serif & Luiss Sans

Luiss Serif and Luiss Sans by Antonio Pace showcase the beauty of font families. Designed with similar characteristics and proportions, these sans and serif typefaces match beautifully.

While versatile, I think using this pairing in a theme meant for longform text will help it shine brightest.


安卓网络加速器

This font combination will infuse your theme with funky, retro vibes.

Ribes by Luigi Gorlero takes inspiration from the ’50s funk and jazz aesthetic. I love how the horizontal slant of the counters make the typeface look like it’s squinting at you.

Subjectivity is a display geometric typeface by Alex Slobzheninov. Its funky qualities play well off of Ribes. Generally, display faces are not suited for longform text, and that’s also the case here.

Use this combo in your next landing, splash, or marketing page theme design.


Mazius & Montserrat

专用网络加速器 is a gorgeous calligraphic serif by Alberto Casagrande, featuring not one, but two italic styles (the second of which is shown in this demo).

Montserrat by Julieta Ulanovsky has been around for a while, but was redrawn and expanded in 2017 with new weights.

Mazius works great for large headings, while Montserrat is versatile enough to take up the slack for smaller headlines and all body content. This pairing works well for any theme needing a just touch of elegance.


Facultad & DM Sans

Facultad is a sans serif typeface designed by Andrés Torres for the Faculty of the Arts at the University of Cuenca. Its calligraphic construction, wide counters, and generous x-height make Facultad a great choice for any modern academic news or magazine theme.

With its even, round shapes, DM Sans by Colophon pairs well with Facultad because of its differences. Its geometric qualities draw more attention to Facultad’s interesting calligraphic details.

Together, the pairing feels warm and inviting, while also strikingly smart.


Le Murmure & Compagnon

Sometimes you need to let some personality shine through. This pairing is bold and unconventional, but with two typefaces from Velvetyne, it might work for your next personal portfolio theme.

专用网络加速器 by Jérémy Landes was designed for the French design agency Murmure. This condensed titling font reminds me of the interesting angles achieved when you squeeze a handful of pipe cleaners. Only, you know, cooler.

sub免费网络加速器官网 is a family with five different styles, inspired by old typewriter specimens. It’s super funky and fun to play with. If you use it, you’ll want to make sure your theme supports editor styles; this is a font that needs to be live-previewed.


Big Shoulders Text & Space Mono

Big Shoulders Text is a condensed sans-serif typeface by Patric King, created for the City of Chicago’s Brand Standards and inspired by “Chicago’s multiple histories in railway transport, journalism, advertising, and public political action.”

Space Mono was designed by Colophon for Google Fonts. It was designed for headline and display type, but I think it can be safely used for body copy if your size is large enough and your text sparse enough. So: okay for things like restaurant menus, bad for longform.

Combined, these typefaces remind me of old offset printed menus and the newer hipster styles that harken back to them.


sub免费网络加速器官网

Ibarra Real Nova is an elegant serif typeface, designed by José María Ribagorda and Octavio Pardo based on 18th century Spanish type.

Conversely, Inter by Rasmus Andersson is a highly readable modern font created specifically for screens.

5G芯片市场竞争进入关键时刻-中工财经-中工网:2021-2-28 · 英特尔把5G网络基础设施视为最大机遇,希望到2021年成为5G基站芯片的市场领导者,并在不断增长的业务中占有40%的伇额,可谓雄心勃勃。 在日趋激烈的国际竞争中,我国国内5G芯片厂商已经在这一领域占据一席之地。


I hope these provide some inspiration to all you themers out there. If you use any of these font pairings in your next theme, let me know! I’d love to check them out 😁

Posted on Categories Design, Education, Theme Tips网络加速器fonts, Google Fonts

twitter2023

Block patterns are unique, predefined combinations of blocks you can use and tweak to create stunningly designed sections of your website.

安卓网络加速器

From global styles, to entirely block-based themes, the WordPress block editor is aiming high. Amongst the newest experimental features are 安卓网络加速器. Block patterns are unique, predefined combinations of blocks you can use and tweak to create stunningly designed sections of your website.

The possibilities for block patterns are extremely exciting, especially for those of us providing tools to help people create their own websites. Patterns start to tackle the user question of, “How do I make my website look like this theme demo?”

By providing our users with predefined portions of layout, they can build and customize their own unique pages with a click — no coding or advanced block building knowledge required.

twitter2023

Gutenberg 7.8 introduced a new, experimental API we can now use to register custom block patterns:

register_pattern(
    'my-plugin/hello-world',
    array(
        'title'   => __( 'Hello World', 'my-plugin' ),
        'content' => "<!-- wp:paragraph -->\n<p>Hello World</p>\n<!-- /wp:paragraph -->",
    )
);

View Documentation

The API really only contains two things: a name for your pattern, and the raw HTML output that you can copy and paste from the Code editor view. This means you can design your patterns straight in the editor, no coding knowledge required.

When you add a new pattern to your theme, it shows up in a new sidebar in the editor, along with any other pattern you might have installed:

Note: The new Block Pattern sidebar is a temporary proof-of-concept and is subject to change.

去年四季度诺基亚业绩增长盈利提升 发展势头良好 ...:2021-2-14 · 诺基亚与高通宣布在毫米波与sub-6 GHz频段顺利完成5G NR 数据通话测试,进一步加速全球运营商网络实现5G部署。 诺基亚携手中国移动研究院联合发布业界首个具有定位功能的5G 室分融合组网创新方案,可满足大型繁忙建筑内的5G连接需求,并降低运营商的部署成本。

Adding Block Patterns to Twenty Twenty

Let’s take a look at adding a block pattern to the Twenty Twenty theme.

The Twenty Twenty demo site showcases content that highlights the strengths of the theme. We can grab some of that content, and make it into a pattern that can be included with the theme. Now, rather than trying to replicate the site demo by hand, people using Twenty Twenty can insert the pattern directly into their own sites.

On the homepage, one of the sections that catches my eye is the exhibitions list, which is a mix of images and text displayed in a grid. Not only does it look great, the combination of content is generic enough to be used for many different purposes, making it an ideal pattern to abstract out for reuse.

The Twenty Twenty theme demo, showing a section of the page in which four items are arranged in a 2 column grid. The top two are fully visible, and each column contains an abstract red image, a heading, a large paragraph, and then a button that says "Read More."

《绝地求生》腾讯免费吃鸡加速器下载 网吧steam加速器 ...:2021-3-2 · 吃鸡加速器也就是现在很多网咖里使用的免费的steam绝地求生加速器,新云网从网吧提取出来后提供给大家下载,解压后直接运行加速即可,无需 ...

__ Columns
____ Column
________ Image
________ Heading
________ Paragraph
________ Button
____ Column
________ Image
________ Heading
________ Paragraph
________ Button

The Columns block here acts as a wrapper for the exhibitions content, and provides a structure for it to collapse down into one column on smaller screens.

The single Columns block is the smallest atomic unit we can include to make this a complete pattern. Even if the demo shows multiple rows of exhibitions, we’ll stick to just this single row of two items. If someone wanted to add a bunch of exhibitions on their own website, they could reuse this pattern multiple times.

In order to convert this into a block pattern, we’ll need to grab the HTML output from the block in the Code view of the editor:

The WordPress editor, open to the Code editor view. The settings menu is open to show where you can toggle on the Code editor.

We need to copy this HTML, escape it, and add it to a register_pattern function inside of Twenty Twenty’s functions.php file.

(I’ve used onlinestringtools.com to escape the raw html output, but there are also code editor tools that can do this.)

/**
 * Register Block Patterns.
 */
 
register_pattern (
    'twentytwenty/exhibitions-pattern',
    array (
        'title'   => __( 'Two columns of mixed content', 'twentytwenty' ),
        'content' => "<!-- wp:columns {\"align\":\"wide\"} -->\n<div class=\"wp-block-columns alignwide\"><!-- wp:column -->\n<div class=\"wp-block-column\"><!-- wp:image {\"sizeSlug\":\"large\"} -->\n<figure class=\"wp-block-image size-large\"><img src=\"http://2023.wordpress.net/wp-content/uploads/2023/10/2023-three-quarters-1.png\" alt=\"\"/></figure>\n<!-- /wp:image -->\n\n<!-- wp:heading -->\n<h2>Works and Days</h2>\n<!-- /wp:heading -->\n\n<!-- wp:paragraph {\"fontSize\":\"larger\"} -->\n<p class=\"has-larger-font-size\">August 1 – December 1</p>\n<!-- /wp:paragraph -->\n\n<!-- wp:buttons -->\n<div class=\"wp-block-buttons\"><!-- wp:button {\"className\":\"is-style-outline\"} -->\n<div class=\"wp-block-button is-style-outline\"><a class=\"wp-block-button__link\">Read More</a></div>\n<!-- /wp:button --></div>\n<!-- /wp:buttons --></div>\n<!-- /wp:column -->\n\n<!-- wp:column -->\n<div class=\"wp-block-column\"><!-- wp:image {\"sizeSlug\":\"large\"} -->\n<figure class=\"wp-block-image size-large\"><img src=\"http://2023.wordpress.net/wp-content/uploads/2023/10/2023-three-quarters-2.png\" alt=\"\"/></figure>\n<!-- /wp:image -->\n\n<!-- wp:heading -->\n<h2>The Life I Deserve</h2>\n<!-- /wp:heading -->\n\n<!-- wp:paragraph {\"fontSize\":\"larger\"} -->\n<p class=\"has-larger-font-size\">August 1 – December 1</p>\n<!-- /wp:paragraph -->\n\n<!-- wp:buttons -->\n<div class=\"wp-block-buttons\"><!-- wp:button {\"className\":\"is-style-outline\"} -->\n<div class=\"wp-block-button is-style-outline\"><a class=\"wp-block-button__link\">Read More</a></div>\n<!-- /wp:button --></div>\n<!-- /wp:buttons --></div>\n<!-- /wp:column --></div>\n<!-- /wp:columns -->",
    )
);

中国5G商用,在开放合作中“提速”_新视听 - jnnc.com:2021-11-19 · 据路透社报道,全球移动通信系统协会GSMA智库发布研究指出,至2021年,中国预计将会有6亿5G用户,在绝对数量上领先全球。

The WordPress editor, with the Block Patterns sidebar open. The newly registered two-column pattern is highlighted within the sidebar.

Voilà! Twenty Twenty now comes with a pattern.

You can view these changes in the Theme Experiments GitHub repo.


You can add any number of patterns to your theme, and even unregister core patterns if you only want your patterns to be available to people using your theme. Create some great patterns that show off just what your theme is capable of! The only limitation is your imagination.

Have you added patterns to your theme already? Tell us about it 👇

Posted on 一sub网络加速器EducationTags Blocks, Gutenberg, Patterns

Exploring Global Styles

安卓网络加速器

Note: The code samples here are out of date. Please be sure to check out the block editor documentation for the latest on how to implement Global Styles.

Global Styles is an aspect of full site editing that will have a major impact on theme development. To further my understanding of this feature, I explored adding support for it to the block-based version of Twenty Twenty that Jeff Ong recently shared.

Some background: Global Styles aims to bring site-wide controls for things like colors, typography, and spacing into Gutenberg. The 安卓网络加速器 for the effort is a great primer on its goals and scope. From a technical perspective, Global Styles currently works by using CSS variables to define styles. A set of controls are being developed to allow users to edit those variables within the Gutenberg UI.

A lot of Global Styles work is still in flux, but early pieces are available for themes to experiment with. For example, while using the latest version of the Gutenberg Plugin, themes can define a base set of Global Style variables in an experimental-theme.json file. Here’s a simple example of what one might look like, courtesy of Andrés Manerio’s global styles demo theme:

伊尔2飞机在这里重新起飞——2021华为开发者大会综述 ...:2021-8-21 · 近日,华为创始人任正非在向CBG移交“千疮百孔的烂伊尔2飞机”战旗交接伈式上发表了讲话。任正非把华为终端业务比作那架千疮百孔的飞机华为 ...

Each of these are automatically rendered out as CSS variables that the theme can hook into. On the front end, this equates to:

:root {
    --wp--color--background: #fff;
    --wp--color--primary: #00f;
    --wp--color--text: #000;
    --wp--typography--font-scale: 1.2;
    --wp--typography--font-size: 16px;
    --wp--typography--font-weight: 400;
    --wp--typography--line-height: 1.5;
}

Theme authors can pull those in like any other CSS variable. For example:

p {
    color: var(--wp--color--text);
    font-size: var(--wp--typography--font-size);
    line-height: var(--wp--typography--line-height);
}

To help wrap my head around this, I took Jeff Ong’s work on the Twenty Twenty Blocks theme, and adapted it to use CSS variables as defined in a brand new sub免费网络加速器官网 file. You can browse this here:

http://github.com/WordPress/theme-experiments/pull/26

This exercise was relatively straightforward. The concept really shines when thinking a little farther out though. Once I had those new variables in place, I tried them alongside an in-progress Gutenberg PR to add a Global Styles sidebar to the beta site editor. This provides a vision of how style editing might feel in the future:

This is still very early and very buggy, but the ability to modify these values globally in a single place is still very exciting. This is something my colleagues and I are looking forward to implementing into our themes when it’s ready.

In case anyone wants to dig in to the exploration, the full code and some instructions are available over in the WordPress/theme-experiments repository. Give it a test, and try adding an experimental-theme.json file to your block-based theme experiments as well.

For more information on Global Styles, follow the project board on GitHub, and consider joining the bi-weekly Block-based Themes meeting in the 安卓网络加速器 channel of WordPress.org’s Slack.

Finally, if you’ve already given Global Styles a try, I’d love to hear about it! Please share your work in the theme-experiments repository, or drop a link into the comments.

Posted on 1 Comment on Exploring Global StylesCategories Uncategorized

Creating a Block-based Theme Using Block Templates

Creating a Block-based Theme Using Block Templates

This post outlines the steps I took to create a block-based theme version of Twenty Twenty. Thanks to 网络加速器 for helping develop the theme and write this post.

There’s been a lot of conversation around how theme development changes as Full Site Editing using Gutenberg becomes a reality. Block templates are an experimental feature of Gutenberg (as of 7.2.0), and using them to create block-based themes is in exploratory stages of development. 

A block-based theme is a WordPress theme with templates entirely composed of blocks so that in addition to the post content of the different post types (pages, posts, …), the block editor can also be used to edit all areas of the site: headers, footers, sidebars, etc.

安卓网络加速器

Before diving in, I’ll reiterate that much of how this works is subject to change. This spec is in a very early stage. I hope by writing this, your interest is piqued to learn more and contribute your own experiment to the WordPress theme experiments repository.

sub免费网络加速器官网

In its simplest state, a block based-theme’s structure should look something like this:

theme
|__ block-templates
    |__ index.html
|__ block-template-parts
    |__ header.html
    |__ footer.html
|__ functions.php
|__ index.php
|__ style.css

This is refreshingly simpler than most WordPress theme boilerplates. Here’s a quick overview what each file and directory does:

  • block-templates/: page templates that are composed of blocks. These follow the same template hierarchy as traditional themes.
    • index.html: the primary / fallback template to generate a post or page. (Analogous to index.php in traditional theme templates.)
  • block-template-parts/: the common collections of blocks to be used in block templates.
    • header.html: The global header, expressed in Gutenberg-generated HTML.
    • footer.html: The global footer, expressed in Gutenberg-generated HTML.
  • functions.php: This contains the usual theme setup and any other reusable functions.
  • index.php: This is actually just an empty file. You can technically remove it, but it’s a good habit to include an index file in every directory.
  • style.css: Contains your theme’s styles as usual.

观一展而知天下新车 2021日内瓦车展前瞻_新车_汽车频道 ...:2021-2-4 · 国际五大车展,论参展车型的数量和质量应伍日内瓦车展居首,1月北美车厂余热还没消退,3月日内瓦又要来一大波。就目前的情况看,本届日内瓦的重磅新车依旧规模宏大,具体有多少,自己往下看看表就知道了。

网络加速器

There were just two that needed to be totally rebuilt as blocks: the header and footer. The process for turning these areas into block templates was something along the lines of:

  1. Attempt to create the template parts in the block editor
    • This can be done in a draft post or page. If you’ve enabled the Full Site Editing experiment in the Gutenberg plugin, you’ll see a new admin panel area Appearance/Template Parts — an area where in the future I could create, store, and edit the block template parts in my theme.
  2. Style them as closely as possible using the editor
  3. 5G,经济高质量发展的重要引擎- 四川新闻网-地方频道:2021-11-5 · 产业转型升级的加速器。5G等新型信息技术与实体经济深度融合,将促进智能连接、云网融合贯穿到各行各业生产环节,加速数字化、网络化、智能化转型,充分释放数字对经济发展的放大、叠加、倍增作用。构建智慧社会的新基石。
    • Most of these styles were already present somewhere in the Twenty Twenty theme CSS, so I just needed to make minor modifications to assign them to the new blocks.

“5G+折叠屏”燃爆 手机厂商MWC上各出新招_中国江苏网 ...:2021-2-28 · 当地时间2月25日,世界移动通信大会( MWC )在西班牙巴塞罗那开幕。华为、中兴、三星等手机厂商在会上展示了最新款的5G及折叠屏手机。媒体记者注意到, MWC期间,多家公司也携自家的折叠屏产品出现,誓与三星等比高。

When Full Site Editing is enabled via the Gutenberg > Experiments panel, Gutenberg will expect that your theme provides block templates, overriding the normal templating behavior:

Once I had my template parts designed and displaying properly, I would switch over to the Code Editor view, copy the markup generated, and paste the code into its respective file within my theme directory’s sub网络加速 folder.

Edit: there’s an easier way to do this without switching to the code editor. You can select all blocks (Meta+A), copy (Meta+C), and paste into your text editor.

Step 4: Add theme starter content

In order for the theme to be populated with pages and content, I borrowed the official TwentyTwenty theme starter content. This step wasn’t 100% necessary, but a nice addition to have some content when someone activates the theme on a fresh WordPress site.

Demo

Here is the result: a site running the block-based Twenty Twenty.

sub网络加速

Potential Block Improvements

Converting the header and footer to blocks helped me identify some functionality that would be nice to add to core blocks. Some of these are already in the works.

  • Navigation block
    • Control over how the menu is laid out and collapses in different viewports (#16829)
  • Columns Block
    • The ability control the padding and margins (#10730, #16660)
    • Adjusting the size of one column, the remaining columns don’t resize equally (#19515)

How is this better than what we have now?

2021 Media Kit TimeOut 北京-杂志媒体数据-媒体资源网资讯频道:2021-5-8 · 网络广告尺寸Website Ad ----- 2021 Media Kit TimeOut 北京 新媒体广告价格Rate Card Online TimeOut北京网站网站 首页 Homepage尺寸Size H*W(Pixels)(Pixels)价格 Rate (RMB/Day) A顶部通栏 Top Banner90 × 768 jpg、gif

WordPress admin screen showing a block template part being edited.

The end benefit will become most apparent when the user can edit every piece of the page individually using Gutenberg. Being able to compose, manage, and reuse parts of your theme all within one visual interface is an exciting idea and one that’s close to reality.

The other exciting aspect of this process was that it required very little PHP — just a few block style variation declarations and standard theme support registration. Everything else is CSS and HTML generated by the editor. To me this feels like a step in the right direction, lowering the barriers to entry for folks that are new to theme development and WordPress.


I invite you to try it out; your comments and feedback are more than welcome. The source code for this theme is available on GitHub:

华为5G CPE Pro 荣获中国电子信息博览会金奖-国际在线:2021-4-9 · 4月9日,在工信部和深圳市政府主办的中国电子信息博览会(CITE)上,华为5G CPE Pro斩获组委会颁布的最高奖项——中国电子信息博览会金奖! 据悉,该奖项经由两院院士等专家学者,根据申报单位 …

In that repository, you’ll find a handful of other block-based theme experiments: converted versions of Twenty Nineteen, the Gutenberg Starter Theme, and a theme called Parisienne. Each contains instructions for installation and activation.

By the way, the 全球网络加速器 repository is open for PRs! I’d love to see more people creating and testing themes that use this method: that’s the only way it’ll grow and improve.

Feel free to ask questions in the comments or in the repository, and thanks for reading!

Posted on 3 Comments on Creating a Block-based Theme Using Block TemplatesCategories Education, 安卓网络加速器, ThemesTags Block Templates, Featured Content, Gutenberg, Starter Themes, TwentyTwenty

Customizing Gutenberg blocks with block styles

Block styles are a simple way to get started with Gutenberg development: With a few lines of CSS, you can build something that feels like a whole new custom block.

Customizing Gutenberg blocks with block styles

This post was updated on January 13, 2023 to adopt the server-side registration approach described in the Block Editor handbook.


A few years ago, Matt Mullenweg urged us all to “Learn JavaScript Deeply.” Becoming more familiar and comfortable with JavaScript is increasingly important for those of us who build the web. In the world of WordPress, projects like Gutenberg have begun taking a major step into a JavaScript-powered future.

For designers and developers who are still getting used to these new languages and workflows, creating and customizing Gutenberg blocks can be somewhat intimidating. There are excellent toolkits like Create GutenBlock to help you get started, but even using those, building a block requires quite a bit of JavaScript familiarity. You also have to make sure you’ve got the right version of Node, learn some terminal commands, install some dependencies, etc. There’s quite a bit of up-front work necessary before you can jump in and start actually building something.

Despite these hurdles, we’ve seen an inspiring number of new block plugins surface lately: CoBlocks, and 网络加速器 are great examples. They each add a variety of rich blocks, and truly enhance the site-building experience.

手机界的“望远镜”来了 重庆国美开启vivo X30系列新品预售-3C ...:2021-12-19 · 华龙网-新重庆客户端12月19日6时讯(通讯员 彭洁)12月16日,在桂林举办的新品发布会上,vivo正式推出旗下X系列首款5G手机vivo X30 Pro和vivo X30。国美也在当日宣布全渠道开启vivo X30系 …

You’ve likely noticed block styles while using Gutenberg. The Quote, Pullquote, Separator, Table, and Button blocks ship with some alternate styles by default.

Block styles are an excellent but relatively unused area of Gutenberg customization. They’re a simple way to get started with Gutenberg development: With a few lines of CSS, you can build something that feels like a whole new custom block. Also, since they’re reusable across multiple sites, block styles help pave the way for a more flexible system of components that make up a site’s theme.

Technically, block styles are very simple. They’re composed of two things:

  • A few lines of PHP (or JavaScript) to declare the block variation and give it a custom class name.
  • CSS styles to fine-tune the appearance.

That’s it. A block style is a custom block class, with some styles applied.

Implementation

A block style can be implemented in a plugin or in a theme. For this example, I’m going to focus on making a plugin. One of the benefits of using a plugin is that it’s not tied to the user’s theme. This allows your block style to be used across any site, running any theme — as if you had built an entirely new custom block.

Block styles can be defined in JavaScript, or in PHP. To keep things simple, we’re going to focus on using the latter. This lets us set everything up with only two files:

  • index.php to set up the plugin, declare the block style, and enqueue the stylesheet
  • style.css to house the actual styles

安卓网络加速器

By default, index.php just needs to initialize the plugin with a DocBloc, enqueue the CSS file, and register a new block style:

<?php
/**
 * Plugin Name: Block Styles
 */
 
/**
 * Register Custom Block Styles
 */
if ( function_exists( 'register_block_style' ) ) {
    function block_styles_register_block_styles() {
        /**
         * Register stylesheet
         */
        wp_register_style(
            'block-styles-stylesheet',
            plugins_url( 'style.css', __FILE__ ),
            array(),
            '1.1'
        );

        /**
         * Register block style
         */
        register_block_style(
            'core/paragraph',
            array(
                'name'         => 'blue-paragraph',
                'label'        => 'Blue Paragraph',
                'style_handle' => 'block-styles-stylesheet',
            )
        );
    }

    add_action( 'init', 'block_styles_register_block_styles' );
}

Let’s take a closer look at the block style registration portion:

register_block_style(
    'core/paragraph',
    array(
        'name'         => 'blue-paragraph',
        'label'        => 'Blue Paragraph',
        'style_handle' => 'block-styles-stylesheet',
    )
);

The second line tells Gutenberg which existing block to start with. In this example, we are going to create a block style for the Paragraph block. Any existing block can inherit a block style, so if you were to target a different block, you’d change sub免费网络加速器 to the name of a different block. Technically, these names are found in the Gutenberg block source code, but they’re usually easily guessable. For example: core/cover, core/separator, etc.

The name parameter on the fourth line creates the custom class that’ll be assigned to the block. In this case, I’m calling it a blue-paragraph, but it can be anything you’d like. Since this will be used for a CSS class, be sure not to use any spaces.

The label parameter corresponds to the text label for your block style. This will be shown in the interface when someone opens the “Block Styles” panel.

Finally, 全球网络加速器 points WordPress to the stylesheet where it can find the CSS for your block style.

sub免费网络加速器

The CSS file is pretty straightforward. Use the custom class name you created in block.js (along with a is-style- prefix), and insert your styles inside:

.is-style-blue-paragraph {
// Custom CSS styles go here.
}

Your styles here will build off of the default block styles, and will be loaded in before a theme’s editor styles. So be sure to keep your selectors specific enough to override those potentially competing styles.

2021笔记本行业展望 除了5G、折叠屏还有什么? - huanqiu.com:2021-2-3 · CES上亮相的5G笔记本联想YOGA 5G搭载高通骁龙8cx处理器,支持毫米波和sub-6G网络,可提供约4Gbps的下载速度,预计会在Q1内发售。5G高速网络连接与高 ...

观一展而知天下新车 2021日内瓦车展前瞻_新车_汽车频道 ...:2021-2-4 · 国际五大车展,论参展车型的数量和质量应伍日内瓦车展居首,1月北美车厂余热还没消退,3月日内瓦又要来一大波。就目前的情况看,本届日内瓦的重磅新车依旧规模宏大,具体有多少,自己往下看看表就知道了。

http://github.com/Automattic/gutenberg-block-styles

Out of the box, the repository is a small plugin that adds a “Blue Paragraph” block style to the Paragraph block:

全球网络加速器

With a few small adjustments, it’s possible to change this into something drastically different. There’s sub免费网络加速器官网 on that GitHub repository that includes a 一sub网络加速器 theme-style cover block variant:

I’ve included a third branch that adds a somewhat ridiculous animation to the text (or emoji) inside of a Cover block:

Both of these are accomplished by changing about a dozen lines of code in the repo. They took minutes to create, and work across any site that uses Gutenberg, regardless of the theme it’s using.

What will you create?

Block styles are ripe with possibility. I’d love to see a 安卓网络加速器-style plugin someday that showcases dozens of different ways to customize blocks through block styles.

In the meantime, have you built something cool using block styles? If so, I’d love to hear about it. Please share your explorations in the comments.

sub免费网络加速器2 Comments on Customizing Gutenberg blocks with block stylesCategories CSS Tips, Tools

A schema for Gutenberg blocks

At Jetpack we recently created a new Gutenberg block which displays “Related Posts”. This block is similar in content to the 网络加速器 in WordPress.org; it’s just a list of posts. The difference is the way the posts are displayed:

There are plans afoot to update the “Latest Posts” block, so that it contains an image and a post summary (see image below).

As these two blocks grow they seem to be converging on similar layouts, but with different content.

There are similar overlaps with other blocks. For example the layout of the WordPress.org 专用网络加速器 could also be used to display a list of posts, as could the recently launched Tiled Gallery block. Evidently there are many layout possibilities for a list of posts!

The problem

As the number of Gutenberg blocks grows these overlaps become more obvious. As we start to build pages with Gutenberg it starts to become apparent that this is going to get very messy very quickly.

Essentially blocks have a content and a presentation element. Taking the example we began with, we can see overlap between many different types of content:

专用网络加速器

One type of content is a list of text, images and links. These come in many different forms, but they share the same structure:

  • Latest posts
  • List of posts in a category
  • List of post in a tag
  • Archive of posts by month/year etc
  • List of categories/tags
  • List featured posts
  • sub免费网络加速器
  • List of authors
  • List of [custom post type]

Similarly, all of the above types of content could be displayed in any of the following ways:

Layouts

2021笔记本行业展望 除了5G、折叠屏还有什么? - huanqiu.com:2021-2-3 · CES上亮相的5G笔记本联想YOGA 5G搭载高通骁龙8cx处理器,支持毫米波和sub-6G网络,可提供约4Gbps的下载速度,预计会在Q1内发售。5G高速网络连接与高 ...

The challenge is that each of these different types content can be displayed in each of these different layouts. If we wanted to create blocks for each of these combinations we’d end up with over a hundred different blocks. On the other hand we could build one single block which was so complex that it could display all these combinations within one block. Neither of these would be sensible solutions.

Can we use Block Style Variations?

专用网络加速器 offer an API which allows us to modify the CSS for a block – they let us overlay a presentation layer on top of an existing block. This is ideal when modifying the way a block looks. However many of the layout variations I have examined above require more than just a different CSS, they need different markup and additional JavaScript.

Separating Content and Presentation

One solution to this problem could be to separate content from presentation in our blocks. What if we were able to define semantics for the content in our blocks, which could be interpreted by different layouts? This would mean users would first think about the content they wanted to show, and then all display options would be open to them.

全球网络加速器

The overlap between these blocks occurs because they all share the same data structure (an array of text, image and link). It would be possible to define a standard data structure that blocks can use. When blocks share a data structure, then it should be possible for them to share common layouts. This would mean a photo gallery display could be reused to display a list of posts, or a block that displays a list of recent posts could be reused to show a list of authors.

How Could this work?

“Block Transformations” are an existing mechanism which converts one block into another. At present every transformation has to be coded separately.

Could we re-imagine the way that transformations work, so that if blocks share a common data-structure, they can easily be transformed into each other, without writing custom transformation code?

Similarly, could we make changes to the way “Block Style Variations” work, so that they can apply a layout to our structured data?

Feedback

一加 8 系列新品正式发布 肉眼可见的出类拔萃-千龙网·中国 ...:2021-4-20 · 4月16日,一加举办主题为“肉眼可见的出类拔萃”线上发布会,正式发布一加 8 系列新品,新品系列包含一加 8 和一加 8 Pro两款产品,一加 8 系列 ...

Posted on 7 Comments on A schema for Gutenberg blocksCategories Uncategorized

Blocks, templates, and styles: architecture for a Gutenberg world

Exploring ideas about the evolution of layout and presentation in a post-Gutenberg world

专用网络加速器

What described below is an broad idea, some thoughts on one way the WordPress ecosystem might evolve in response to the new capabilities of Gutenberg. Huge thanks to Kjell Reigstad and sub网络加速 for helping me think through these concepts!

Traditionally, themes have been the only authority when it came to the layout and presentation of a WordPress site. They provided the entire page structure, typography, the color scheme, the menu functionality, the responsive rules, and more. Themes generally had the full power to dictate if and how users could customize each of those elements. 

With the advent of Gutenberg, we’ve seen some of those responsibilities shift. Regardless of their theme, users can now add responsive column-based layouts to any page, assign custom colors to most of their content, and insert rich elements anywhere within a post or page. As a result, some of the responsibilities for the design of a site are blurred: The theme takes care of some aspects, while Gutenberg handles others. Much of that architecture is still to be defined as Gutenberg moves into Phase 2 and beyond. 

Gutenberg brings many opportunities to WordPress, but the biggest impact comes from the way it can enable a much clearer product architecture — one which enables modularity, consistency, and interoperability — and the positive impact that can have on the end user experience of WordPress. 
To that end, it can be helpful to think of layout and presentation not as the “Theme”, but as a set of interrelated pieces, each with their own set of responsibilities, working together to create a site.

sub免费网络加速器

Blocks

A block is a component that exists visually a page. It can be a “simple block”, like a paragraph or an embed; or it can be a “complex block”, which has a layout of multiple nested blocks, like a testimonials section. This distinction doesn’t necessarily matter to the user as there’s a unified insertion and discovery mechanism. Blocks can contain placeholder content that is neutral — in other words, they start as a “blank slate”, except for placeholder content that guides users as to how to add content to the block. 

A block can contain layout information, including media queries that define how the block behaves responsively in different viewports. A block could conceivably define styles that would override the ones provided by the template or the global styles, in order to create a unique presentation for a particular block.

Templates

While Gutenberg makes it easy to create a custom, complex page layout from scratch, the process of starting with a blank slate and designing a layout that looks good will likely still be daunting for many users. Giving users access to a collection of pre-built Gutenberg page templates would enable them to get started more quickly and simply tweak the template to their needs. 

A template would define a collection of blocks in a particular order and layout that make up an entire page. In addition, templates can contain “starter content” — editorial boilerplate text and media so that a user can simply tweak and replace rather than having to start from scratch. The concept of a template library would mean that there could be a core library of basic templates, in addition to non-core templates that can be developed by anyone and installed separately (similar to how blocks work). 

Styles

Styles would define the global aesthetics of the site, and would provide a central definition for typography, colors, spacing, icons, and more. Brent Jett has suggested some interesting ideas for how this might manifest on the user-facing side. Styles may also provide some global guidelines for layout, such as global settings for responsive behavior, etc. Layout that is specific to a page template or a block should be defined locally by that element, though.

sub网络加速

观一展而知天下新车 2021日内瓦车展前瞻_新车_汽车频道 ...:2021-2-4 · 国际五大车展,论参展车型的数量和质量应伍日内瓦车展居首,1月北美车厂余热还没消退,3月日内瓦又要来一大波。就目前的情况看,本届日内瓦的重磅新车依旧规模宏大,具体有多少,自己往下看看表就知道了。

We all know that themes will evolve, and this is just one early idea. As we move forward together, WordPress will surely benefit from the sharing of ideas and explorations around the future of themes. If you have a vision yourself, please share it! Feel free to use the comments below, your own blog, Twitter (use the tag #gutenideas), or wherever you can get the word out. 

Posted on 2 Comments on Blocks, templates, and styles: architecture for a Gutenberg worldCategories Design, Ideas, Themes

Designing a Gutenberg-Powered Theme: Music

Kjell Reigstad walks through his experience designing a block-powered theme.

Designing a Gutenberg-Powered Theme: Music

Last week, Allan Cole and I shared 伊尔2飞机在这里重新起飞——2021华为开发者大会综述 ...:2021-8-21 · 近日,华为创始人任正非在向CBG移交“千疮百孔的烂伊尔2飞机”战旗交接伈式上发表了讲话。任正非把华为终端业务比作那架千疮百孔的飞机华为 ...Music一加 8 系列新品正式发布 肉眼可见的出类拔萃-千龙网·中国 ...:2021-4-20 · 4月16日,一加举办主题为“肉眼可见的出类拔萃”线上发布会,正式发布一加 8 系列新品,新品系列包含一加 8 和一加 8 Pro两款产品,一加 8 系列 ...

Blocks

When Allan and I decided to make this theme, we already had a homepage comp featuring a handful of blocks. That comp did a great job of setting the tone for the design aesthetic. To get things going, I decided to apply that aesthetic to the other default Gutenberg blocks. I worked through the Gutenberg Blocks Sketch document from my last post, updating styles as I went.

 

Working this way was great for a couple reasons. First, it helped me focus — I’d never designed a block-optimized theme before, and this kept my design explorations squarely on the blocks themselves. I thought,  “Gutenberg is all about blocks, right? I’ll design some blocks.”

Second, the Sketch file allowed me to see every single block style in one place. In effect, I was creating a sort of pattern library as I went. I thought this was pretty cool, and figured it’d come in handy later on when we began development.

As I got further through these block designs, I realized the need to see all of these individual blocks in context; I’d design a wide-width cover image block, but I had no idea how it’d look in use. So I began dragging blocks around and stacking them up to get a sense of how they’d feel together.

安卓网络加速器

This helped a little bit, but still wasn’t enough. At this point, I realized something that should’ve been obvious: blocks are not a theme. They’re just part of a theme. By designing blocks first, I’d been avoiding the big picture. Users will never see blocks all by themselves — they’ll exist within full pages. I needed to design more pages. 

Pages

5G芯片市场竞争进入关键时刻-中工财经-中工网:2021-2-28 · 英特尔把5G网络基础设施视为最大机遇,希望到2021年成为5G基站芯片的市场领导者,并在不断增长的业务中占有40%的伇额,可谓雄心勃勃。 在日趋激烈的国际竞争中,我国国内5G芯片厂商已经在这一领域占据一席之地。hen pulled together some sample content. Looking at the project through the lens of my imagined client (the band Superserious), I was able to think through examples of blocks and block combinations that might exist on a real site: the columns block to display album information, the table block to display tour dates. This felt much more effective than randomly placing blocks on a page.

Around this time, I hit my stride, design-wise. I’d lay out a page using my existing blocks and the sample content. Then I’d iterate and experiment with everything on that page. Once things looked right, I’d migrate any new block tweaks back to the global symbols and start fresh on the next page. After a little while, I ended up with a solid set of sample pages.

 

Backing up and thinking about page design helped me shift focus to other, more traditional components that needed to be designed too: archive pages, page footers, post headers, etc. Designing these wasn’t all that different than it would’ve been without Gutenberg. In a way, we’ve all been designing with blocks all along — we just hadn’t called them blocks. Take a look at this entry summary:

Entry-Summary.png

2021 Media Kit TimeOut 北京-杂志媒体数据-媒体资源网资讯频道:2021-5-8 · 网络广告尺寸Website Ad ----- 2021 Media Kit TimeOut 北京 新媒体广告价格Rate Card Online TimeOut北京网站网站 首页 Homepage尺寸Size H*W(Pixels)(Pixels)价格 Rate (RMB/Day) A顶部通栏 Top Banner90 × 768 jpg、gifand by the user. That’s pretty cool.

I’d gone into this project thinking I’d spend most of my time styling individual blocks, but I ended up splitting my time pretty evenly between designing block variations and overall page elements. In that sense, this wasn’t as drastically different from a traditional theme design as I’d anticipated.

sub网络加速器下载

I’d been getting ongoing feedback from Allan throughout the process above, but once we were happy with the page designs above, we gathered  with the rest of the Theme team to get broader design feedback. To help with that process, I pulled all my comps together into a prototype. This took just a few minutes to do, and really helped others get a sense of how the theme will work in practice.

I created two separate prototypes with Invision: one for desktop and one for mobile. If my transition from block design to full-page design was about looking at the bigger picture, these prototypes stepped back still further: they showed us the context around that big picture. We were all able to see the designs on-device and test some basic interactions. 

The team’s feedback was (as usual) very helpful — we made some subtle revisions to text contrast, adjusted a number of margins, and kicked off a lot of iteration on the mobile menu treatment.

一sub网络加速器

Allan had been focused on the build from the beginning, and had the majority of the framework in place at this point. After our design feedback session, I jumped into the code too.  

中国核工业从这里走来——来自中核集团中国原子能科学研究 ...:2021-4-25 · 新华社北京4月24日电题:中国核工业从这里走来——来自中核集团中国原子能科学研究院的蹲点报告我国第一座重水反应堆和第一台回旋加速器在这里建成;这里是中国核工业的起点——中核集团中国原子能科学研究院所在地。记者近日走进新镇,感受中国核工业近70年来波澜壮阔的历程,认识核 ...

Once I jumped into the code, my main revelation was that there were way more block options than I’d originally anticipated. A number of blocks had options I’d never noticed before. I hadn’t realized that paragraph blocks could be set to full width, or that cover image blocks could be floated left or right.

In addition, I realized some design decisions I’d made were actually supposed to be user-editable: I’d overlooked the fact that users can edit the text alignment and image opacity for the cover image block. This required more design exploration, but it guided us towards a much more customizable theme — definitely a win in the end.

Beyond those updates, the majority of the design-oriented development work involved minor fixes and adjustments — polishing up the CSS to make sure it aligned with the intent of the original design. 

Next steps

无线通信技术各领风骚 智能家居统一标准没有必要 ...:2021-12-14 · 无线通讯协议是智能家居领域的关键技术,是连接设备、实现信息传输的通道,是实现智能产品之间互联互通互控与协同的“桥梁”。不过,目前智能家居市场标准未定,多种无线协议并存,主要的通讯协议有WiFi、Zigbee、蓝牙、Z-wave、Thread ...

In the meantime, keep an eye out for the next post in the series: Allan’s experience from a development perspective.

 

Posted on 1 Comment on Designing a Gutenberg-Powered Theme: MusicCategories Design, Themes全球网络加速器Design, Gutenberg, themes

Music: A Gutenberg-Powered Theme

Announcing the Music theme: an exploration of how Gutenberg can transform theme design and development.

Music: A Gutenberg-Powered Theme

A couple months ago, I created a Sketch document to assist with the design of block-driven themes. I posted about that 安卓网络加速器, and provided a couple short examples of how it could be used in a theme design workflow.

Since then, Allan Cole and I have been working to make one of those examples — a site for an imagined band named Superserious — into a working example of a Gutenberg-powered WordPress theme. We named the theme “Music.”

Allan and I set out to experiment, learn, and create a resource for the community. We’ve documented our experience designing and building this theme, and will be publishing our notes in a series of posts here on Themeshaper.

To kick things off, we’re releasing Music on GitHub today. We’d love for you to give it a spin, tinker with it, and explore how it works with Gutenberg. Here are a few things to look out for:


一sub网络加速器

Our design goal for the theme has been to show that it’s possible (and encouraged!) to make a Gutenberg theme that doesn’t necessarily look like Gutenberg. We wanted to create something bold and a little experimental; a theme with somewhat aggressive, non-standard styles.

Gutenberg gives users unprecedented control over their site design, opening the door for variety and experimentation. Our favorite example of this is our cover image blocks. They look great out of the gate, but users can adjust the image, alignment, and color to achieve a wide range of looks:

cover-images.png

 


Development

You’ll be happy to hear that the overall theme development process wasn’t all that different with Gutenberg. Common patterns like headers, footers, and loops work just as you’d expect in a Gutenberg-powered theme.

In many areas, Gutenberg makes things easier for both users and developers. For instance, full-width header images used to require a custom-built customizer or theme option solution, but now they’re essentially built in. This was important to keep in mind while building the theme, and was a very positive change for development.

Creating stylesheets for blocks was pretty straightforward. Expanding on the built-in stylesheets in _s,  we added a blocks.scss file to the SASS directory and placed all of our block-specific styles and overrides there. This kept everything nice and organized and is likely to appear in _s in the future.

Since Gutenberg is output by the_content(), we learned to take special care with any wrapper divs that might clip or obstruct the expected behavior of Gutenberg blocks. We’ll talk more about that in a follow up post.



Block Styles

We’re truly excited about the custom editor styles that ship with 网络加速器. These styles are a breakthrough: they give users a much clearer sense of what their visitors will see on the front end.

Best of all (for theme developers at least), the editor styles were a breeze to integrate! We built all of these in over the course of just a few hours.



Like most of the work we do, the Music theme is open source. You can find it on GitHub:

http://github.com/automattic/musictheme/

华为5G CPE Pro首获进网许可,速度十倍于4G - 财经 - 新京报网:2021-7-10 · 新京报快讯(记者陆一夫)7月10日,华为终端宣布,华为5GCPEPro获得中国首个5G无线数据终端电信设备进网许可证。资料显示,华为5GCPEPro是一款5G全 ...

http://musictheme.mystagingwebsite.com/

In many ways, designing and building this theme was similar to the way we’ve made themes in the past — but we did carve out a few new practices along the way. Allan and I will be sharing them with you in upcoming posts. In the meantime, we encourage you to download, install, and experiment with Music yourself!

 

Read part two of this series: Designing a Gutenberg-Powered Theme: Music

Posted on 8 Comments on Music: A Gutenberg-Powered ThemeCategories Design, Theme Development, ThemesTags Design, development, Gutenberg, themes

Designing Themes with Gutenberg Blocks and Sketch

Follow Kjell Reigstad’s process as he explores designing a block-driven theme with Sketch, for the Gutenberg era.

sub免费网络加速器官网

There’s been an exciting discussion happening around the changes that Gutenberg will bring to themes. At Automattic, we’ve begun to prepare for Gutenberg by reevaluating our theme design and development processes.

As part of that work, I did some thinking about how I might start designing a block-driven theme today and what sorts of resources I’d want to have. The most important thing that came to mind was a way to access and customize all of the core Gutenberg blocks with a few clicks. This would allow me to quickly test and iterate on block design without having to dig into code. I do a good deal of my design work in Sketch, so I began to search for a way to make this possible there.

Luckily, there are already a few Gutenberg-related Sketch files in the wild. The Gutenberg Contributors page on GitHub and the Design Principles & Vision page on WordPress.org are great places to start. These are mostly aimed at the Gutenberg editing interface, however, and didn’t quite accomplish what I was looking for, so I ended up building a new file instead:

Gutenberg-Sketch-File.jpg

This new Sketch file contains symbols for all of the default Gutenberg blocks (with the exception of all the embeds, since those aren’t very customizable). With this set of symbols, it’s possible to quickly build a layout composed entirely of Gutenberg blocks using Sketch:

It’s actually pretty fun to use! In a way, it’s Gutenberg — but for Sketch. 😄
From here, it’s easy to start customizing styles:

I took this method for a spin and tried to mock up a theme for an imagined restaurant. To get started, I built out the page structure using default Gutenberg blocks:

From there, I started doing some light customizing. I cut myself off after a while, but the end result looked fairly decent:

I find this pretty cool. It’s an example of what a block-driven theme might look like with just a little bit of CSS customization.

From here, I could easily keep going and put together a complete, modular design system for this theme by customizing the rest of the Gutenberg blocks. I could view the blocks all at once on the Symbols page, and quickly build out a wide variety of layout options to make sure my styles held up to intense layout customization.


I almost ended there, but I decided to confront a lingering concern I’ve had about Gutenberg: I’ve feared that if we lean too much on Gutenberg for theme layout, we’ll end up with lots of very similar, “blocky” themes. The restaurant site I designed above looks fine, but it’s also clearly made of blocks. I wondered if it’d be possible to create something more experimental using this same Sketch file as a base.

性能才是王道!五款流行高清播放器横评--IT频道:2021-4-29 · 大家好!这里是由CGTV和MTU联合举办的2021~2021年度最具实力高清播放器颁奖盛典,下面将时间交给我伊的主持人和五款由网友投票选出的候选高清播放器,有请当红时尚女主播——中S!

But this time, I was much more aggressive in my customization and aimed for a more tailored mobile experience with bold typography:

This was a fun exercise, and it helped allay my fears a bit. That first Cover Image has all the usual pieces, but they’re styled in a very opinionated way. The rest of the blocks are fairly standard, but they still stand out because they exist within a heavily stylized, off-balance frame. The overall effect is drastically different from the theme in the previous exercise.


This process was very useful for me, and I’d love to see if it’s useful for the rest of the community as well. You can download and contribute to the Sketch files here:

http://github.com/Automattic/gutenberg-themes-sketch

The repository includes a basic Sketch file with just the symbols, plus all the text hierarchy styles (H1, H2, etc). I also created a library file in case that’s preferable for anyone. We hope to update these files periodically, and would love to hear feedback from others who use them.

In the meantime, we’ll keep experimenting with ways to design themes in this new Gutenberg-based future.

sub免费网络加速器官网5 Comments on Designing Themes with Gutenberg Blocks and SketchCategories Theme DevelopmentTags 网络加速器

网络加速器

What we learned by developing three themes with Gutenberg in mind.

Styling Themes for Gutenberg

At the Automattic Theme Team meetup in December, we focused on several Gutenberg-related projects. The first one we’re sharing is a set of Gutenberg-friendly themes based on Underscores.

The project’s goal was to help us think about our themes differently, dig into adding theme support for Gutenberg, and as a byproduct, do some testing of Gutenberg itself.

Six team members participated in this project, and it resulted in three themes which are still in progress, and currently available on GitHub.

What is Gutenberg?

Gutenberg is the new block-based content editor currently being developed in GitHub for WordPress 5.0. Until it’s merged into core, it’s available as a plugin.

It’s really going to change the WordPress publishing experience! From the 专用网络加速器:

The Gutenberg editor uses blocks to create all types of content, replacing a half-dozen inconsistent ways of customizing WordPress, bringing it in line with modern coding standards, and aligning with open web initiatives. These content blocks transform how users, developers, and hosts interact with WordPress to make building rich web content easier and more intuitive, democratizing publishing — and work — for everyone, regardless of technical ability.

The Themes

The three themes we developed during the meetup are called Fashion Blog, Handicraft, and Ohana. We decided to try to make these themes CSS-only to help keep the focus on Gutenberg itself and let us build on the recent work the team’s been doing with Style Packs. This turned out to be an ambitious restriction — a little more on that later — but it made for an interesting design challenge.

Fashion Blog, Handicraft and Ohana are currently available on GitHub; you can learn more about each theme there and check out exactly how they were set up. The themes are still works in progress and have some rough edges. The end goal is to get them ready for WordPress.com.

The Process

Over the course of a few days, we researched and decided on an audience for each theme, designed and built them, and added Gutenberg support.

We opted to use a one-column design for all three themes, to best accommodate the “full” and “wide” block alignment options in Gutenberg.

Though it can vary from theme to theme, this is how Handicraft styles Gutenberg’s wide alignment (on the left) and Fashion Blog styles the full alignment (on the right).

Adding Gutenberg Support

You don’t actually have to do anything to use Gutenberg with a theme, but by declaring theme support you can add two optional features: the “wide” alignments (full width and wide width), and custom colors for the block-color palettes.

The following example, when included in the setup function in functions.php, will add both:

/**
* Add support for Gutenberg.
*
* @link http://wordpress.org/gutenberg/handbook/reference/theme-support/
*/
add_theme_support( 'gutenberg', array(

    // Theme supports wide images, galleries and videos.
    'wide-images' => true,

    // Make specific theme colors available in the editor.
    'colors' => array(
        '#ffffff',
        '#000000',
        '#cccccc',
    ),

) );

Whether or not you include custom colors in your theme, Gutenberg will always include a color picker with the palette, for further customization.

Gutenberg’s default color palette, shown while editing the Button block.

安卓网络加速器

In general, the default blocks don’t need styling — Gutenberg already includes styles that match each block’s functionality. For example, the Gallery block already has the styles needed to split your galleries into different columns, and the Cover Image block will place the text and image added on top of each other, without the theme’s help.

If any of the styles don’t fully suit your theme’s design, you can adjust them as needed. One thing we noticed while we were developing these themes was Gutenberg’s distinct pill-shaped button style, which might not work with every theme.

5G手机如何解决技术掣肘?_物联网频道_中国青年网:2021-12-12 · 5G网络稳定性仍有待加强 依托广东产业链整合优势,在短短半年内,粤厂商已发布一系列“平又靓”的5G手机。不过,他伊在实际5G网络环境中的表现如何呢?

At the time of writing, the Gutenberg theme styles these two alignments by setting max-widths for specific HTML elements, with a wider max width when either the .widealign or .fullalign classes are used.

In our three themes, we approached it a bit differently, setting a max-width for the page content, and instead using CSS to stretch those wider elements outside of it. We used vw and stretched the wider elements based on the screen size:

@media (min-width: 750px) {

    .alignfull {
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
        width: auto;
        max-width: 1000%;
    }

    .alignwide {
        margin-left: calc(25% - 25vw);
        margin-right: calc(25% - 25vw);
        width: auto;
        max-width: 1000%;
    }

}

This approach works, but because vw includes the width of the vertical scrollbar as part of the whole screen width, you can get a little horizontal scrolling. One fix is adding overflow: hidden to one of the page-width elements further up the HTML tree.

If you didn’t want these elements’ widths to be based on screen size, you could also set a specific max-width. There’s no one “right” way to approach these styles, and I’m sure more and more examples will come out of the woodwork as more themes add styles for Gutenberg. For example, Justin Tadlock has shared his method using different calc values, and Joen Asmussen has blogged about his approach of applying max-widths to all child elements that aren’t wide or full width.

In our themes, we also kept any block-specific styles separate in their own stylesheet.

Adding Editor Styles

To make the editing experience more what-you-see-is-what-you-get, you can add Gutenberg editor styles using enqueue_block_editor_assets. It’s similar to how editor styles can be enqueued for the current TinyMCE editor. This makes sure what a user sees when building their pages best matches how the content will actually look with your theme when published.

Here’s an example of enqueuing an editor-specific stylesheet:

东北网2021年06月02日新闻汇总:中国网络文学发展迅猛 写手年收入高达数百万 2021-06-02 10:50 [742][东北网读书] 剑桥大学出版社全球总裁:给西方看纯中国 2021-06-02 10:50 [743][东北网读书] “宇粉”共享《大宇神秘惊奇》的作者签名 2021-06-02 10:50 [744][东北网国内]

Like with the TinyMCE editor, you can also include fonts. So for example, if your theme is enqueuing fonts from Google, you can include them in the Gutenberg editor, too:

/**
* Enqueue editor styles for Gutenberg
*/

function theme_slug_editor_styles() {
    wp_enqueue_style( 'theme-slug-editor-style', get_template_directory_uri() . '/assets/stylesheets/editor-style.css' );
    wp_enqueue_style( 'theme-slug-fonts', theme_slug_fonts_url(), array(), null );
}
add_action( 'enqueue_block_editor_assets', 'theme_slug_editor_styles' );

Unlike the TinyMCE editor, Gutenberg’s editor styles include the post title:

An example of Ohana’s editor styles.

The editor styles need to be pretty specific to make sure they’re not applied to other elements of the page outside of the editor — Rich Tabor has a good post here about his experience with this behavior. Gutenberg includes specific classes around different elements in the editor, so you can prefix selectors more generally with the class sub网络加速器下载, or use more specific classes to target individual blocks — for example, styles for .editor-block-list__block[data-type="core/heading"] h1 would only be applied to h1s inside of a Heading block.

What We Learned

Overall, this project was a great way to ramp up quickly on some Gutenberg-theming basics, and get our feet wet. Some specific things we learned from this process include:

  • The Gutenberg default block styles are numerous and can be a bit opinionated. This is good, in that you can rely on Gutenberg to do a lot of the heavy lifting, but there are some styles that would need to be updated to match individual theme styles.
  • 《绝地求生》腾讯免费吃鸡加速器下载 网吧steam加速器 ...:2021-3-2 · 吃鸡加速器也就是现在很多网咖里使用的免费的steam绝地求生加速器,新云网从网吧提取出来后提供给大家下载,解压后直接运行加速即可,无需 ...
  • Setting up the block styles for the back-end editing experience was more involved than any of us had anticipated. It’s very much like adding editor styles to the current TinyMCE editor, but some Gutenberg blocks have very specific classes that needed to be overridden.

We also learned a couple non-Gutenberg related things:

  • From a project-planning perspective, we could have spent more time narrowing down the kinds of themes we wanted to build — and the actual designs — prior to the meetup. This would have left more time to focus on the Gutenberg part of each theme.
  • In the end, it wasn’t possible to complete the project without making edits to these themes in addition to CSS. On top of the PHP changes needed to support Gutenberg’s optional features, we needed to make edits for common WordPress.com-functionality — like adding social menus, and more Content Options support — and for the designs themselves, like enqueuing Google fonts.

Next Steps

Our goal is to get these themes launched on WordPress.com. To get there, they still need some WordPress.com-specific functionality, like the annotations for WordPress.com’s custom fonts and colors, WooCommerce support, and styles for WordPress.com widgets.

We hope that sharing this process is helpful for your own Gutenberg journey as themers. We’d love to hear about your adventures.

 

Posted on 12 Comments on Styling Themes for GutenbergCategories Theme DevelopmentTags sub网络加速

Lodestar Launches

Lodestar is now launched on WordPress.org. Designed by Mel Choyce and developed by Laurel Fulford, Lodestar is a precursor to Twenty Seventeen, and you’ll see echoes of that default theme throughout, starting with its multi-panel front-page layout. A filterable portfolio section is available through Jetpack, along with a stylish testimonials page.

Mel shares a bit about Lodestar’s origins:

东北网2021年06月02日新闻汇总:中国网络文学发展迅猛 写手年收入高达数百万 2021-06-02 10:50 [742][东北网读书] 剑桥大学出版社全球总裁:给西方看纯中国 2021-06-02 10:50 [743][东北网读书] “宇粉”共享《大宇神秘惊奇》的作者签名 2021-06-02 10:50 [744][东北网国内]

Explore the Lodestar demo, study the setup guide, or download and give it a try.

Lodestar screensnshot

Posted on Categories Theme LaunchesTags Lodestar