Connect with us

WORDPRESS

Our CloudFest Hackathon Report – WordPress.com News

Published

on

Our CloudFest Hackathon Report – WordPress.com News

With WordPress today you need to use custom code or a plugin to create a custom post type like “Book” or “Member.” This is a popular need, and there are a variety of approaches; however, one challenge is that the end-user experience can be confusing and non-standardized.

A few weeks ago, some Automatticians and I went to the 7th CloudFest Hackathon in Rust, Germany to explore a solution for this. We started hacking on a deeply nerdy project, JSON Schema forms and fields, and ended up with a fascinating approach to an age-old question: What if you could register custom post types and custom fields directly in the WordPress admin?

Forty-eight hours turns an idea into reality

The CloudFest Hackathon is an event that allows developers from around the globe to take ideas and turn them into realities.

During the Hackathon, teams of developers from various content management systems and hosting companies come together to contribute to projects that align with the core principles of the event: the projects must be not-for-profit, interoperable, and open source.

Last year, we worked on a project that allowed us to embed WordPress directly in VS Code. We built the WordPress Playground VS Code extension on top of WordPress Playground. It uses WebAssembly to run WordPress entirely within the browser, and it turned out pretty darn slick

This year, we focused on a JSON Schema Field/Form Renderer. While most of us explored using JSON Schema to dynamically register admin forms and fields, Dennis Snell and Adam Zieliński decided to take the project one step further! They hacked together a plugin that introduced the ability to register custom post types and custom fields directly from the WordPress admin. More notably, everything happens within the block editor—you have to see it to believe it:

This work poses some interesting possibilities for custom post type and custom field implementation because it could fundamentally change the way low- to no-code WordPress users modify their sites.

Naturally, I took the idea to Twitter/X:

I got quite a range of responses, ranging from “Heck Yes! It should have already been a core feature now. Such an integral part of every other site” to “Admin should only be for content and user management. Everything else should be configured in code and version controllable.”

So why the range in responses? Let’s discuss.

It turned out to be pretty simple

Dennis and Adam built our prototype using the following conventions:

  • A custom post type wp_data_type holds templates for user-defined data types.
  • The title of a post in the wp_data_type defines the name of the new data type. The post itself is the rendering template and comprises any set of normal blocks. Names are given to select block attributes within the post, and these names are mapped into the data type.
  • When creating new posts for the given data type, the locked template is copied from the wp_data_type template, and the block attribute annotations are preserved.
  • Finally, when rendering the wp_data_type template, the attributes are pulled from the individual post of the given data type and spliced into the template.

The fascinating idea is that we don’t have to think about form fields; blocks already provide a rendering view and a modal editing experience. We can rely on the fundamental way blocks work and use the very same user experience to create custom data types in a way that users are already familiar with when editing a post or a site.

We can provide JSON-LD markup properties to the block editor using our Custom Fields Names block settings.

Custom post types define custom data types, so we use a template to not only define the data type, but also to provide a default rendering template. Each data attribute within a post type has a field where it’s possible to define that field with its JSON-LD property. 

For example, say you had a “Book” custom post type. A few JSON-LD properties you could define using custom fields are:

  • description
  • copyrightYear
  • author
  • bookEdition
  • bookFormat
  • isbn
  • numberOfPages

We also chose to store a copy of each block attribute in the JSON attributes for that block. Since WordPress can now provide a post-to-JSON function, which merges the extracted attributes with the names assigned in the custom post type template, that template may have changed since the custom post was created. This means that no database migrations are necessary to render an updated version of a post.

The best part? The WordPress infrastructure that already exists (aka Gutenberg!) defines the data type. Because these custom posts are normal posts, and because they adopt the locked template for the data type definition, they are, in fact, renderable on their own! Even if the template has been updated and only the post itself is rendered, it will still display a meaningful representation of the data type as it was when it was created.

While our original Hackathon project was tailored towards developers and UX designers who would love to see a forms and fields API in WordPress, this prototype puts more power in the hands of low- to no-code WordPress users.

It also opens up a world of possibilities for providing a rendering view for any structured data. Imagine uploading a CSV and mapping the column names to block attributes, or connecting to a database or JSON API to map the records in the same way. 

For example, if you had a CSV with business names, addresses, a rating, and a description, we could take that template post and insert a map block, a heading block, a star rating block, and a paragraph block and set the attributes to map to the CSV columns. It’s essentially an instant structured data renderer!

But even if we can define custom post types and fields in the editor, should we, as a WordPress community, consider adding it to core?

The existential question: Should it exist?

Adding this kind of functionality into WordPress core could open up a ton of opportunities for the average WordPress user. Instead of needing to get a developer involved to add a custom post type to their site, a user could simply do it themselves and define the necessary fields and structured data attributes. 

On the other hand, allowing everyday users, who may not have a full grasp of how custom post types and structured data should work, free reign to create these data types themselves could have detrimental effects on the user experience of their websites. Clunky or incorrect implementation of structured data markup could also cause issues with how search engines crawl these sites, causing unintended negative impacts to search traffic.

Not only that, but as of right now, if a custom post type is accidentally deleted, all of the content posted to that custom post type will no longer be accessible through the admin (even though it will still be stored in the database). The user could think they “lost” their data.

Let’s talk about it

What do you think? Are you in favor of giving website owners the ability to change and customize their custom post types and attributes? Or are there some website features that should always require a more technical hand and implementer? 

We’d love to chat with you about your thoughts in the comments below.

For another interesting exploration on a related idea, check out this discussion on GitHub with the core team.


Thanks to Lars Gersmann for leading the JSON Schema project with me and to everyone on the Syntax Errors team: Adam Zieliński, Dennis Snell, Julian Haupt, Michael Schmitz, Anja Lang, Thomas Rose, Marko Feldmann, Fabian Genes, Michael Schmitz, Jan Vogt, Lucisu, Maximilian Andre, Marcel Schmitz, and Milana Cap.


Join 110M other subscribers



Source link

Keep an eye on what we are doing
Be the first to get latest updates and exclusive content straight to your email inbox.
We promise not to spam you. You can unsubscribe at any time.
Invalid email address

WORDPRESS

14 Print-on-Demand Tips You Can’t Afford to Ignore | Printful

Published

on

By

If you’re looking for print-on-demand tips, you’re either just starting out or want to improve your existing store. Regardless of which you are, …

Source link

Keep an eye on what we are doing
Be the first to get latest updates and exclusive content straight to your email inbox.
We promise not to spam you. You can unsubscribe at any time.
Invalid email address
Continue Reading

WORDPRESS

Visual Composer review 2024: A free website builder dedicated to WordPress

Published

on

By

In our detailed Visual Composer review we explore this top website builder tailored specifically for WordPress users. Visual Composer stands out as a versatile and powerful plugin that lets businesses and creative individuals build stunning and highly functional websites without any coding knowledge. As a WordPress plugin, it seamlessly integrates with the platform, offering a simple drag-and-drop interface for building and customizing web pages.

Our expertise in site building and WordPress plugins allows us to provide trustworthy advice on Visual Composer’s capabilities and features. With years of experience in evaluating website builders and design tools, our insights aim to guide readers like yourself in making smart decisions about their online presence.

Source link

Keep an eye on what we are doing
Be the first to get latest updates and exclusive content straight to your email inbox.
We promise not to spam you. You can unsubscribe at any time.
Invalid email address
Continue Reading

WORDPRESS

WordPress Filter Tags Explained – Crocoblock

Published

on

By

WordPress Filter Tags Explained - Crocoblock

Is it possible to organize content on a WordPress site or blog so that it is quickly found by users and better indexed by search engines?

Of course! Use WordPress tag filters.

Tags are an underrated WordPress tool because more and more website owners and developers are using categories to organize content. But there are other ways, and tags can also help users find what they’re looking for, especially if you have a lot of content.

In this article, we will discuss tags, how they can help you, how to add them to your WordPress site, and how to use them for filtering content.

Table of Contents

Tags are an essential feature of WordPress, similar to keywords. You can combine different publications using a specific parameter, topic, or word and assign them a tag. When the user clicks on this tag, they will be taken to the section where different materials are collected, and materials that have this tag are displayed.

For example, if a WooCommerce website is dedicated to furniture, clicking on the “leather sofa” tag will allow the user to use the WooCommerce tag filter and see a page where leather sofas are collected.

This feature improves the user experience and helps search engines better understand your site’s content and relevance to potential visitors.

Both categories and tags serve the purpose of organizing content on a WordPress site. They represent two types of WordPress taxonomy: hierarchical and non-hierarchical. 

A category is a hierarchical type of taxonomy, and a tag is non-hierarchical. 

This means that while you can have parent and child categories, you can’t have parent and child tags. 

Both categories and tags are used to classify and organize content on a WordPress site, but they serve slightly different purposes. Categories are often used for broad topics or themes because you can create a broader category, e.g., “Continents,” then add a “Countries” child category there, and then create the “Cities” child category. Just like folders on your computer. 

Tags, in turn, are usually used for more specific or granular topics when nesting is not needed, or, vice versa, for very broad ones, which don’t need more specifying. For example, you have a blog with articles, videos, and podcasts about visual art. Also, you have different categories organized by movements, styles, etc. But you also want to filter posts by content types. So, you can add “Videos,” “Articles,” and “Podcasts” tags. Thus, users can select both topics and content types. Default WordPress posts have to belong to a certain category (by default, “Uncategorized”). But if you create a custom post type (CPT), it’s up to you whether to create taxonomies for them or not. If you want to add CPTs or taxonomies for them, JetEngine is one of the most advanced solutions on the market for not only creating but also managing them.

JetEngine has way more features.
Explore them all.

Buy plugin

To add tags to your publication, create a new post/page/custom post, or click “Edit” on the existing one, and then in the right sidebar, add the desired tag:

adding tag to new post

You can add multiple tags at once by separating them with commas.

Check the tags before publishing your finished post to ensure everything is correct. If you don’t understand what tag to use yet, WordPress allows you to choose from the most popular ones.

NOTE

Choose only tags that directly relate to the publication and will help your readers navigate your site.

How to Filter Content Using Tags?

Filtering content by tags is fairly easy. One can use tag filters in the following ways: adding them to a menu, using a dedicated filter plugin, or writing custom code.

Tag menu

If you want to add tags to the menus, go to Appearance > Menus > Screen Options and check the box next to tags. Now, you can add tags to the menu. 

If you use tags a lot, making a separate menu containing them is a good idea and the simplest way to create a filter by tags. It can be displayed on a sidebar on one of the pages.

adding tags to the menuadding tags to the menu

Using a filter plugin

If you want a more advanced approach to content organization and want your site to have not only tags but also filters, use additional plugins, such as JetSmartFilters.

JetSmartFilters plugin homepageJetSmartFilters plugin homepage

The JetSmartFilters plugin allows you to create convenient filters on your page and filter your site content by various parameters. 

The plugin has an Active Tags feature, which allows you to display active tags and, accordingly, see the content based on these tags. For example, users choose “humor” and “paper” tags and see books with such parameters. In the Active tags field, they can see these tags. 

In this article, you will find detailed instructions on how to set up and activate this feature.

In addition, JetSmartFilters can help you add some other functionality related to tag filters. For instance: 

  1. Remove applied filters. If you need a button that helps you remove all applied filters at once, add it with the Remove Filters feature. You can place it just in the right place, and when clicked, users can remove all the filters they have applied earlier. Here are detailed instructions
  2. Active filters. If you want to show all active filters on the page, you can use the Active Filters widget. It showcases all currently applied filters and allows users to remove those that are not relevant one by one. Here are detailed instructions on how to use this feature.

Custom code

Last but not least, you can create tag filters by writing custom code. In this article, you can find a simple example of such a code. 

FAQ

How do I add tags to my site?

You can use WordPress’s built-in feature to add tags before publishing a post or employ additional plugins. Plugins usually have more functionality for organizing content on the site.

What is tag filtering?

Tag filtering allows users to filter content by specific keywords and view only the pages and posts they want. A Tag filter in WordPress filters posts containing specific tags from your dashboard and search results.

How do I set tags?

Look at your new content’s topic and add related keywords. Choose words that will be relevant to your topic to help your users find the information they’re looking for faster. There must be frequently used words for your topic.

In Conclusion

Tags are a helpful option for quickly categorizing and organizing your content. They help users navigate within their areas of interest and help site owners deliver information correctly.

Tags are a built-in feature of WordPress that can be used without additional skills or plugins.

Of course, tags won’t replace filters or categories, but they help improve the user experience, so using them on blogs and other content-rich website types is a good idea.

Source link

Keep an eye on what we are doing
Be the first to get latest updates and exclusive content straight to your email inbox.
We promise not to spam you. You can unsubscribe at any time.
Invalid email address
Continue Reading

Trending