• Stars
    star
    144
  • Rank 246,050 (Top 6 %)
  • Language
    PHP
  • License
    GNU General Publi...
  • Created over 1 year ago
  • Updated 26 days 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
18,713
star
2

gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
JavaScript
9,662
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,556
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,206
star
6

wordpress-playground

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

gutenberg-examples

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

two-factor

Two-Factor Authentication for WordPress.
PHP
684
star
9

gutenberg-starter-theme

A simple theme for testing Gutenberg.
PHP
675
star
10

theme-test-data

Theme Test Data
587
star
11

dashicons

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

theme-experiments

Experimenting with themes made out of blocks.
CSS
542
star
13

book

Our book about WordPress. Version 1
512
star
14

twentytwentytwo

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

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
326
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

theme-check

Theme Check plugin
PHP
321
star
18

performance

Performance plugin from the WordPress Performance Group, which is a collection of standalone performance modules.
PHP
310
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

create-block-theme

A WordPress plugin to create block themes
JavaScript
285
star
21

phpdoc-parser

Documentation parser powering developer.wordpress.org
PHP
232
star
22

Learn

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

meta-environment

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

plugin-check

A repository for the new Plugin Check plugin from the WordPress Performance team
PHP
183
star
25

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
182
star
26

application-passwords

PHP
182
star
27

twentytwentyfour

PHP
181
star
28

wp-feature-notifications

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

openverse

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

twentytwentyone

Ongoing development of Twenty Twenty-One, the new default WordPress theme slated for 5.6.
PHP
178
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
168
star
32

sqlite-database-integration

Feature Plugin to add SQLite support to WordPress. Under Development.
PHP
163
star
33

classic-editor

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

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
133
star
35

twentytwentythree

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

wporg-plugin-guidelines

WordPress.org Plugin Directory Guidelines
121
star
37

block-interactivity-experiments

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

wordcamp.org

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

HelpHub

The WordPress user documentation portal
PHP
108
star
40

pattern-directory

The WordPress Block Pattern Directory
PHP
106
star
41

browsehappy

PHP
101
star
42

Security-White-Paper

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

packages

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

playground-tools

TypeScript
86
star
45

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
85
star
46

slides

Slides: Presentations with WordPress
JavaScript
82
star
47

servehappy-resources

Third-party articles and specific tutorials on PHP upgrades.
78
star
48

block-development-examples

Practical examples for building WordPress blocks and extending the Editor.
JavaScript
78
star
49

wordpress-importer

The WordPress Importer
PHP
76
star
50

openverse-api

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

Advanced-administration-handbook

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

wpcs-docs

WordPress Coding Standards Docs
71
star
53

openverse-frontend

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

Documentation-Issue-Tracker

Issue Tracker for the WordPress Documentation team.
70
star
55

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
70
star
56

wp-lazy-loading

Feature plugin for testing and experimenting with the "loading" HTML attribute.
PHP
69
star
57

hosting-handbook

WordPress Hosting Team Handbook
PHP
67
star
58

revisions-extended

PHP
66
star
59

phpunit-test-runner

PHP
63
star
60

wp-plugin-dependencies

WordPress Feature Project: Plugin Dependencies
PHP
62
star
61

wporg-code-analysis

An experiment.
PHP
59
star
62

wpdev-docker-images

Docker images for use with the Core local development environment.
Dockerfile
57
star
63

wporg-main-2022

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

openverse-catalog

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

wp-autoupdates

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

servehappy

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

community-themes

A collection of Block Themes built by the WordPress community.
HTML
53
star
68

data-liberation

49
star
69

grunt-patch-wordpress

Patch Trac based projects
JavaScript
47
star
70

wporg-mu-plugins

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

WordPress-Documentation-Style-Guide

Style Guide for WordPress documentation.
46
star
72

wporg-developer

WordPress.org Developer theme
PHP
45
star
73

design-experiments

A simple plugin for WP-Admin design experiments. Brought to you by the WordPress Design Team.
CSS
44
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
43
star
75

wp20-book

Our book about WordPress. Version 2
42
star
76

plugin-check-legacy

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

better-code-editing

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

five-for-the-future

Plugins and themes for the Five for the Future subsite
PHP
35
star
79

css-audit

JavaScript
34
star
80

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
33
star
81

rollback-update-failure

Feature plugin to test zip rollback of plugin/theme update failures.
PHP
31
star
82

meeting-calendar

The plugin powering https://make.wordpress.org/meetings/
PHP
30
star
83

theme-review-action

JavaScript
28
star
84

wporg-news-2021

The WordPress.org News Theme
SCSS
28
star
85

phpunit-test-reporter

PHP
27
star
86

block-theme-examples

A repository of feature examples for block themes.
PHP
27
star
87

block-directory

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

gutenberg.run

Gutenberg live branch preview provisioning service
JavaScript
25
star
89

wporg-two-factor

2FA for WordPress.org accounts
JavaScript
23
star
90

Marketing-Team

The central repository for the WordPress Marketing Team
22
star
91

contributor-day-handbook

21
star
92

openverse-browser-extension

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

blueprints-library

PHP
20
star
94

wporg-showcase-2022

The official theme of the WordPress.org showcase.
PHP
18
star
95

spain-handbook

Manuales de la Comunidad de WordPress EspaΓ±a (Handbook)
15
star
96

google-fonts-to-wordpress-collection

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

wporg-documentation-2022

PHP
14
star
98

wporg-parent-2021

SCSS
14
star
99

block-course-theme

HTML
14
star
100

Community-Issue-Tracker

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