• Stars
    star
    188
  • Rank 205,563 (Top 5 %)
  • Language
    PHP
  • License
    GNU General Publi...
  • Created almost 2 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Demo of the Interactivity API

Interactivity API Demo - WP Movies

πŸŽ₯ Live demo: wpmovies.dev

Interactivity.API.-.WP.Movies.demo.mp4

WARNING - CODE IS CURRENTLY BROKEN (see below, Setup)

What is this?

This is a demo plugin which shows the features of the Interactivity API for WordPress proposed in this post in Make WordPress Core blog.

The plugin is split into:

  • /src/blocks/interactive - Start here to understand how to build interactive blocks with the Interactivity API. The folder contains all the custom interactive blocks used in the demo.

  • /lib - The code that contains the runtime and internals of the Interactivity API and the configuration needed to run the demo.

  • /wp-movies-theme - The custom theme used in the demo. Contains some custom styling and the templates for the header & footer as well as the movie & actors pages.

When will I be able to use the Interactivity API?

The Interactivity API is an experimental feature and not ready for adoption yet. It is under active development and its final public API is very likely going to change before an official release.

Setup

⚠️ WARNING: These instructions don't work anymore because there's a conflict between the Interactivity API shipped in the Block Interactivity Experiments plugin and the Interactivity API shipped now in Gutenberg. We'll migrate this repo to use only Gutenberg, but in the meantime, please use this Getting Started guide if you want to test the Interactivity API. If you have questions, you can open a discussion in the Interactivity API category of GitHub.

  1. Install the required plugins:

    • If you use wp-env, run npx wp-env start to install the plugins automatically and run a local WP instance.

    • Otherwise, install the following plugins:

  2. Install the dependencies and build the plugin:

    npm install && composer install
    npm run build

    If you plan on tinkering with the frontend code, start the webpack server which automatically rebuild the files when you make any changes:

    npm start
    
  3. Install the theme:

    You need to install and activate the Movies Demo Theme. Again, if you are using wp-env, it is already installed by default and you just have to activate it. You can run:

      npx wp-env run cli "wp theme activate wp-movies-theme"
  4. Add the movie and actor data to the WordPress database:

    You can import the data manually:

    1. Go to Tools > Import > WordPress and click on Run Importer.
    2. Select the wp_sampledata_movies.xml file.
    3. Select the Download and import file attachments and click on the Upload file and import.
    4. Repeat the process for the wp_sampledata_actors.xml file.
    5. Repeat the process for the wp_sampledata_media.xml file. This one can take up to five minutes.

    If you are using wp-env, you can run the following commands:

      npx wp-env run cli "import wp-content/plugins/wp-movies-demo/wp_sampledata_movies.xml --authors=create"
      npx wp-env run cli "import wp-content/plugins/wp-movies-demo/wp_sampledata_media.xml  --authors=create"
      npx wp-env run cli "import wp-content/plugins/wp-movies-demo/wp_sampledata_actors.xml --authors=create"

    If you run into any problems you can run npx wp-env clean all and start this step over again.

  5. Set the permalinks to use the Post name in Settings > Permalinks.

    If you are using wp-env you can just run this command:

    npx wp-env run cli "wp rewrite structure '/%postname%/'"
  6. Change settings to show 8 posts and RSS items per page in Settings > Reading

  7. Enable the Client Side Navigations in the Settings > WP Directives.

Things to try

Client-side Navigations and pagination

When enabled, the lists of movies and actors will paginate without doing a full page refresh. You can enable this behavior in your WordPress admin page in Settings > WP Directives. Click around to the next/previous page of the movies or actors. You the list is loaded without a delay. This is because the HTML for that page is prefetched ahead of time, and only the nodes that are different between the current page and the next page are updated.

Add to favourites

When you add a movie to favourites notice how the number of movie likes is preserved when navigating to another page. In addition to client-side navigations, the Interactivity API uses a smart DOM diffing algorithm. This allows the interactive state of blocks on the current page to be preserved!

Instant search

Try searching for movies or actors. The search results are rendered dynamically on the server!

Remove the Search template

Try opening the site editor and removing the "Search" template. You'll notice that the Search experience keeps working but that now the Search results look different. That's because in the absence of the Search template, the Archive template is being used. The Interactivity API is designed to work with the server-rendered markup and Full-site editing.

Play the movie trailers

When you navigate to the page for a movie, you can play its trailer. If you have the client-side navigations enabled, you'll notice that the trailer will keep playing as you keep navigating around the site!

Credits

Powered by WordPress and TMDb.

More Repositories

1

WordPress

WordPress, Git-ified. This repository is just a mirror of the WordPress subversion repository. Please do not send pull requests. Submit pull requests to https://github.com/WordPress/wordpress-develop and patches to https://core.trac.wordpress.org/ instead.
PHP
19,332
star
2

gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
JavaScript
9,873
star
3

Requests

Requests for PHP is a humble HTTP request library. It simplifies how you interact with other sites and takes away all your worries.
PHP
3,572
star
4

WordPress-Coding-Standards

PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions
PHP
2,383
star
5

wordpress-develop

WordPress Develop, Git-ified. Synced from git://develop.git.wordpress.org/, including branches and tags! This repository is just a mirror of the WordPress subversion repository. Please include a link to a pre-existing ticket on https://core.trac.wordpress.org/ with every pull request.
PHP
2,295
star
6

wordpress-playground

Run WordPress in the browser via WebAssembly PHP
JavaScript
1,612
star
7

gutenberg-examples

Examples for extending WordPress/Gutenberg with blocks.
JavaScript
1,189
star
8

two-factor

Two-Factor Authentication for WordPress.
PHP
724
star
9

gutenberg-starter-theme

A simple theme for testing Gutenberg.
PHP
686
star
10

dashicons

Dashicons, the WordPress admin icon font. For the official resource, please see the WordPress Developer Hub.
JavaScript
563
star
11

theme-experiments

Experimenting with themes made out of blocks.
CSS
549
star
12

book

Our book about WordPress. Version 1
520
star
13

twentytwentytwo

Twenty Twenty-Two, the default WordPress theme that will launch with WordPress 5.9.
PHP
407
star
14

theme-check

Theme Check plugin
PHP
335
star
15

performance

Performance plugin from the WordPress Performance Group, which is a collection of standalone performance modules.
PHP
327
star
16

twentynineteen

Twenty Nineteen is a theme now included in all WordPress installs. To report any issues please go here: https://core.trac.wordpress.org/newticket
CSS
324
star
17

twentysixteen

Twenty Sixteen is a theme now included in all WordPress installs. To report any issues please go here: https://core.trac.wordpress.org/newticket
CSS
323
star
18

create-block-theme

A WordPress plugin to create block themes
JavaScript
304
star
19

twentytwenty

Twenty Twenty is included in Core as of WordPress 5.3 πŸŽ‰ To report any issues, please go here: https://core.trac.wordpress.org/newticket
CSS
300
star
20

Learn

WordPress.org Learn - The canonical source for the code and content behind https://learn.WordPress.org
PHP
271
star
21

plugin-check

A repository for the new Plugin Check plugin from the WordPress Performance and Plugins Team.
PHP
246
star
22

openverse

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Python
246
star
23

phpdoc-parser

Documentation parser powering developer.wordpress.org
PHP
237
star
24

sqlite-database-integration

Feature Plugin to add SQLite support to WordPress. Under Development.
PHP
219
star
25

twentytwentyfour

PHP
197
star
26

meta-environment

A collection of scripts that provision the official WordPress.org websites into a Varying Vagrant Vagrants installation.
PHP
190
star
27

wp-feature-notifications

WP Feature Notifications - a proposal to modernise the way in which WordPress handles emails, admin notices and user notifications
PHP
188
star
28

application-passwords

PHP
183
star
29

twentyseventeen

Twenty Seventeen is a theme now included in all WordPress installs. To report any issues please go here: https://core.trac.wordpress.org/newticket
CSS
180
star
30

twentytwentyone

Ongoing development of Twenty Twenty-One, the new default WordPress theme slated for 5.6.
PHP
179
star
31

health-check

Health Check is a WordPress plugin that will perform a number of checks on your WordPress install to detect common configuration errors and known issues.
PHP
175
star
32

block-development-examples

Practical examples for building WordPress blocks and extending the Editor.
JavaScript
169
star
33

classic-editor

A plugin to restore the Classic Editor in WordPress.
PHP
160
star
34

playground-tools

TypeScript
136
star
35

secure-swfupload

A fork of the long-abandoned SWFUpload project, maintained by WordPress and others to ensure that a secure version of SWFUpload exists. Report security vulnerabilities to [email protected].
ActionScript
135
star
36

wporg-plugin-guidelines

WordPress.org Plugin Directory Guidelines
125
star
37

wordcamp.org

WordCamps are casual, locally-organized conferences covering everything related to WordPress.
PHP
124
star
38

twentytwentythree

Twenty Twenty-Three, the default WordPress theme sporting many styles that will launch with WordPress 6.1.
HTML
124
star
39

pattern-directory

The WordPress Block Pattern Directory
PHP
123
star
40

HelpHub

The WordPress user documentation portal
PHP
112
star
41

block-interactivity-experiments

⚠️ WARNING: This repository is no longer active. The development and discussions have been moved to the Gutenberg repository.
PHP
109
star
42

wordpress.org

WordPress.org Meta, Git-ified. Synced from git://meta.git.wordpress.org/ This repository is just a mirror of the WordPress Meta subversion repository. Please include a link to a pre-existing ticket on https://meta.trac.wordpress.org/ with every pull request.
PHP
107
star
43

browsehappy

PHP
102
star
44

Advanced-administration-handbook

WordPress Advanced Administration Handbook. This handbook will have the most technical, general, documentation about WordPress.
95
star
45

Security-White-Paper

The WordPress Security White Paper, available directly on the WordPress.org site at https://wordpress.org/about/security/
HTML
95
star
46

packages

Collection of JS modules and tools for WordPress development
JavaScript
87
star
47

slides

Slides: Presentations with WordPress
JavaScript
86
star
48

Documentation-Issue-Tracker

Issue Tracker for the WordPress Documentation team.
81
star
49

servehappy-resources

Third-party articles and specific tutorials on PHP upgrades.
80
star
50

community-themes

A collection of Block Themes built by the WordPress community.
HTML
80
star
51

wordpress-importer

The WordPress Importer
PHP
78
star
52

wpcs-docs

WordPress Coding Standards Docs
77
star
53

openverse-api

The Openverse API allows programmatic access to search for CC-licensed and public domain digital media.
Python
76
star
54

WP-Reasons

A public domain marketing flyer/brochure about the reasons to use WordPress, brought to you by some members of the WordPress community.
HTML
72
star
55

openverse-frontend

The gateway to the Openverse. Openverse is a search tool for CC-licensed and public domain content across the internet.
Vue
72
star
56

hosting-handbook

WordPress Hosting Team Handbook
PHP
71
star
57

revisions-extended

PHP
70
star
58

data-liberation

69
star
59

wp-lazy-loading

Feature plugin for testing and experimenting with the "loading" HTML attribute.
PHP
68
star
60

phpunit-test-runner

PHP
65
star
61

wporg-main-2022

A block-based child theme for WordPress.org, plus local environment
PHP
64
star
62

wp-plugin-dependencies

WordPress Feature Project: Plugin Dependencies
PHP
63
star
63

wporg-code-analysis

An experiment.
PHP
62
star
64

wpdev-docker-images

Docker images for use with the Core local development environment.
Dockerfile
61
star
65

wporg-developer

WordPress.org Developer theme
PHP
61
star
66

wporg-mu-plugins

Development of the Global Header and other mu-plugins used on WordPress.org.
PHP
60
star
67

openverse-catalog

Identifies and collects data on cc-licensed content across web crawl data and public apis.
Python
57
star
68

wp-autoupdates

Feature plugin building a UI for opting-in to plugin, theme, and core auto-updates.
PHP
56
star
69

servehappy

Information page about PHP versions and updates, to be used through the WordPress.org project.
53
star
70

grunt-patch-wordpress

Patch Trac based projects
JavaScript
49
star
71

WordPress-Documentation-Style-Guide

Style Guide for WordPress documentation.
47
star
72

design-experiments

A simple plugin for WP-Admin design experiments. Brought to you by the WordPress Design Team.
CSS
47
star
73

blueprints

Blueprints gallery and examples
Python
46
star
74

press-this

Press This is a little tool that lets you grab bits of the web and create new posts with ease. It will even allow you to choose from images or videos included on the page and use them in your post. Use Press This as a quick and lightweight way to highlight another page on the web.
CSS
45
star
75

wp20-book

Our book about WordPress. Version 2
43
star
76

plugin-check-action

Test your WordPress plugin with Plugin Check
TypeScript
42
star
77

five-for-the-future

Plugins and themes for the Five for the Future subsite
PHP
39
star
78

plugin-check-legacy

Work in progress of a "Plugin Check" plugin, this is in development and is not final.
PHP
39
star
79

css-audit

JavaScript
38
star
80

better-code-editing

[βœ… Merged into 4.9-alpha] Better Code Editing WordPress plugin
CSS
38
star
81

wporg-two-factor

2FA for WordPress.org accounts
JavaScript
37
star
82

developer-blog-content

In this GitHub space, WordPress team coordinate content to be published on the Developer Blog. Discussion and montly meetings (first Thu) in WP Slack #core-dev-blog
37
star
83

meeting-calendar

The plugin powering https://make.wordpress.org/meetings/
PHP
35
star
84

block-theme-examples

A repository of feature examples for block themes.
PHP
34
star
85

rollback-update-failure

Feature plugin to test zip rollback of plugin/theme update failures.
PHP
33
star
86

wporg-news-2021

The WordPress.org News Theme
SCSS
31
star
87

blueprints-library

PHP
30
star
88

theme-review-action

JavaScript
28
star
89

phpunit-test-reporter

PHP
28
star
90

Marketing-Team

The central repository for the WordPress Marketing Team
27
star
91

block-directory

Block library: Timeline and plan: https://make.wordpress.org/design/2019/04/26/block-library-installing-blocks-from-within-gutenberg/
27
star
92

contributor-day-handbook

25
star
93

gutenberg.run

Gutenberg live branch preview provisioning service
JavaScript
25
star
94

openverse-browser-extension

A cross-browser extension that lets you search, filter, and use openly-licensed images.
JavaScript
21
star
95

google-fonts-to-wordpress-collection

Gets the Google fonts collection and transform it to a WordPress font library collection, including SVG previews
JavaScript
19
star
96

wporg-showcase-2022

The official theme of the WordPress.org showcase.
PHP
19
star
97

spain-handbook

Manuales de la Comunidad de WordPress EspaΓ±a (Handbook)
18
star
98

wporg-parent-2021

SCSS
17
star
99

classic-widgets

A plugin to restore the Classic Widgets in WordPress.
PHP
17
star
100

Community

WordPress Community Team Projects and Plans | https://make.wordpress.org/community/
16
star