Code Monkey home page Code Monkey logo

sb-coming-up's Introduction

Coming up

banner

Display future events

Description

Use the Coming up plugin to enable your website to display content that's scheduled in the future.

Use the Coming up block to display these future posts.

Installation

  1. Upload the plugin files to the /wp-content/plugins/sb-coming-up directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the 'Plugins' screen in WordPress

Frequently Asked Questions

Will all 'future' posts be visible?

Yes, unless they are otherwise protected.

Why not use an events plugin?

  • Do you just need to ability to display content with dates in the future?
  • Do you really need a fully featured events plugin?

What other plugins are there?

To my knowledge this is the only one that supports the block editor.

There are a few plugins on wordpress.org that support future posts.

  • The Future is Now!
  • Future
  • Display Future Posts
  • Show Future Posts on Single Post

None of these have been updated in the last 6 years!

Screenshots

  1. Coming up block and settings

Upgrade Notice

0.0.1

Update for post excerpt support.

0.0.0

This is a prototype single block plugin. Expect significant improvements.

Changelog

0.0.1

  • Added: Add support for displaying the post excerpt
  • Changed: Format using divs

0.0.0

sb-coming-up's People

Contributors

bobbingwide avatar

Watchers

 avatar  avatar

sb-coming-up's Issues

Create a coming up block

WordPress'es support for future events assumes that the only person who can see them is the author. It all stems back to when WordPress was just a blog. You could write a load of posts and schedule them to appear on the publication date. But what if you are a club and need to publish future events. Well there are hundreds of plugins related to Events. Some of them are very popular. But they are also a big overhead when all you need is the ability to indicate when the event is.

I've developed a number of bespoke solutions that deal with events:

Each of these used a Custom Post Type ( CPT ) with a custom field that stored the event date.

I already knew that I could display the future content using a shortcode.

[bw_table post_type='post' post_status='future' fields=title,post_status,post_date orderby=date order=desc]

But clicking on the link only displayed the content when I was logged in.

I wondered how easy it would be to create future events either as Posts or Pages which would be visible to other site users.

I started a new plugin ( called oik-future) and wrote under 10 lines of code.

When the plugin's loaded then call this initialisation routine

oik_future_loaded();

Add an action to hook into the query

function oik_future_loaded() {
	add_action( 'pre_get_posts', 'oik_future_pre_get_posts' );
}

If the query is the main query then change it to load Scheduled ( future) posts as well as Published ( publish ).

function oik_future_pre_get_posts( $query ) {
	if ( $query->is_main_query() ) {
		$query->set( 'post_status', ['publish', 'future']);
	}
}

And lo and behold I was able to see the future events even when not logged in.

Here's the table of events...

image

And here's the first post viewed in Firefox, by a non logged in user.
image

Well that wasn't hard. Now what?

Requirements

  • To create events in the future
  • To display a list of future events
  • To be able to view each event
  • Regardless of user type
  • Event list to be automatically updated on date change
  • Future events to include the current date?
  • Display fields such as Title (as a link ), publication date, excerpt, read more

Proposed solution

  • Develop a block called oik-sb/coming-up
  • that will server side render the equivalent of the bw_pages / bw_table shortcode
  • With styling of the date to be similar to Events plugins
  • Add support to display posts with post status future to any site visitor.

Unwanted Notices when using the Widgets block editor in WordPress 5.8-RC3

This is the same problem as noted in bobbingwide/bobbingwide#30 (comment)
It occurs for the sb-coming-up block which uses server side rendering to render the posts.
The block works in the Widgets block editor.
But there's a Notice due to the block's dependency on wp-editor

image

The Coming Up block wasn't developed with the Widget block editor in mind.
It works fine in a FSE theme, where widget areas no longer exist as entities.
But now that the Widget block editor is here then, along with many other blocks developed pre Widget block editor era, this block should also be capable of operating in widget areas.

The trouble is, apart from removing the hook that's producing the Notice ( see the referenced comment), I have no idea how to resolve the problem.

In my opinion I'm doing nothing wrong.
It's core that's not worked out how to deal with it, and it's passing the buck.
Either the core code needs changing OR a very clear set of Field notes are needed.

See also WordPress/gutenberg#33443

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.