=== Blocks For Sermon Manager ===
* Contributors: dramb
* Tags: Sermons, Sermon Manager, Blocks
* Requires at least: 6.7
* Tested up to: 7.1
* Stable tag: 1.0.0
* License: GPLv2 or later

Blocks For Sermon Manager displays sermons and sermon lists/grids from
the Wordpress plugins Sermon Manager or MattyTap Sermons in Gutenberg editor.


== Description ==

Blocks for Sermon Manager allows you to display sermons from the Wordpress
Plugin Sermon Manager or Mattytap Sermons within the block builder of
your website without resorting to using the normal shortcodes.

This plugin provides three kinds of Blocks:

* Blocks that bring the existing shortcodes to the Block editor, with
  attributes you can edit in the block editor to see the effect, and
  which then call through to the existing shortcode in the background.
  With these you can replace the existing shortcodes with blocks and see
  the same output as before.  We provide blocks for the following
  Sermon Manager shortcodes:

	* **sermons** ... to display a list or grid of sermons, with many
	  filters to focus in on a specific set of sermons if needed. This is
	  in the block called "Display Sermons" 
	* **sermon_images** ... to display the images of each series, (not
	  sermons, despite the name) optionally with the series title and/or
	  description extract. This is in the block called "Sermon Images"
	  despite the obvious misnomer of the original short-code. 
	* **sermon-_sort_fields** ... to display the filter bar that allows
	  the user to 'drill down' the list of sermons displayed.  This is
	  in the block called "Display Filters" because that makes more sense!
	* **List-Sermons** ... to display a simple text list of series,
	  preachers, service types, bible books or topics from the sermon
	  taxonomies. This is in the block called "List Sermons", again
	  despite the obvious misnomer of the original shortcode.
 
* Blocks that provide sermon grids and lists without dependence on the
  existing shortcodes.  These have less configuration and give a predefined
  output that should be suitable for most uses. Currently we provide:

	* **Sermon grid** ... where each sermon is displayed in a 'card'
	  with the sermon image and details and a link to the fuller single
	  sermon page.
	* **Single sermon** ... to display one sermon with the sermon image,
	  all its details and a media player.

  These blocks can also be put into Block Theme templates for Sermon
  Manager Sermons / Series / Book / Author / Service Type template pages

* Field blocks that allow each field of Sermon Manager data to be included
  within a bespoke 'Query Loop' block so that you can create your own
  lists of sermons with bespoke look and feel from within the block
  editor without having to do any coding.
  
The plugin also provides some example Query Loop patterns that use these
fields to output Sermon Grids, Sermon Lists and Single Sermons.

   
== Support ==

If you have a problem or a feature request, please send a message to the
author using the 'Support' tab.


== Demo ==

These blocks are currently in use on the www.cambray.org church website.

On the Latest Sermons page: https://www.cambray.org/resources/latest-sermons/

	The shortcode block **Display Sermons** is used for the Recent Sermons
	at the top of the page, and the **Sermon Images** block is used for the
	image grid of the past sermon series.

On the All Sermons page: https://www.cambray.org/sermons

	The **Sermon Grid** block, preceded by the **Sermon Filter**
	block are used to display the list of all sermons. 


== Contributions ==

This plugin relies on the Sermon Manager or MattyTap Sermons plugin being
already installed and sermons already entered into the website.  It is
purely to enable the display of sermons to be more 'block friendly' and 
does not replace or change any of the functionality of these plugins.


== Installation ==

* From within Wordpress - In the Wordpress Dashboard use the menu to go
  to Plugins and from there choose 'Add new plugin'.  Search for
  'sermon manager' and then look for this plugin.  Select the 'install'
  button on the plugin to install it, and once installed use the
  'activate' link to activate the plugin.

* If you want to install from github:

	- Download from 'releases'
	- Rename the zip file downloaded 'blocks4cs.zip' (i.e. remove any
	  version info in the filename)
	- In Wordpress use the Install New Plugin page to upload the zip
	  file, or alternatively, unpack and upload the blocks4sm directory
	  to your '/wp-content/plugins/' directory.
	- Once you have done either of the above, Activate the plugin
	  through the 'Plugins' page in the WordPress dashboard.

* Once you have used either method to install the plugin, you need to
  then add a block (see examples below) to your wordpress posts or pages
  where you need them


== Usage ==

=== Using the Block Replacements for Shortcodes ===

* Add one of the blocks in the place where you wish to use them, as you
  would have previously added a shortcode.
* Use the attributes to choose those attribute values you would have
  previously put into the shortcode.
  *  The default attribute values provided in the attributes respect the
     default values in the shortcodes - you only need to set values you
     want to be changed.
  *  The display of sermons in the block editor will change to reflect
     the attribute choices you make.  The output should be very similar
     to what you will see on the front end, but always check the front
     end to be sure of how it appears.
  *  As with the shortcodes, the appearance of the output of these
     blocks can be changed via css style sheets.  If you want to only
     change the appearance for the output of the block and not the
     original shortcodes, then precede each css style with the class
     `.b4sm`.  The same classes are used for styling as for the shortcodes.

=== Using the new non-shortcode Sermon Display Blocks ===

* Add one of the blocks in the place where you wish to use it.
* If you are adding the block within a Block Template, then the block
  will pick up the correct sermons in the front end, but in the back
  end it will say that it can't find any sermons.  This is because it is
  only a Template and does not have a sermon query for that page until
  the Template is rendered on the front end.
* Use the attributes to choose what to display of the available sermon
  meta data.
* The block output on the front-end can be styled using css style sheets.
  The blocks use the same css classes as Sermon Manager for the various
  elements of each Sermon. If you want to only change the appearance for
  the output of the block and not other Sermon Manager output, then
  precede each css style with the class`.b4sm`.

=== Using the Blocks for the Sermon Manager Fields to create custom output ===

The following allows you to re-create a sermon grid layout. This is just
an example - you can create whatever output look you want!

* Add an outer container (such as a Group or similar) to contain the output
  In the advanced block attributes, set the class to `wpfc-sermons-container`
  if you want the internals to pick up Sermon Manager styles.
* Within this outer container add a `Query Loop Block`.
* In the attributes pane of the Query Loop block, choose to do a Custom
  Query
* In the Custom Query, choose Sermons (or whatever of the taxonomies you
  want.  You can also use the other taxonomies to 'drill down' to only
  display the particular sermons you want on that page.
* In the Query add a container block (such as a Group).  If you want to pick
  up the predefined Sermon Manager styles, in the 'Advanced' attributes
  section add a class `wpfc-sermon` (if it is a sermon you are rendering.
* Optionally, if you want to separately style an outer and inner block,
  add a container block within the previous block and set it's class
  to `wpfc-sermon-inner`.
* In the container block add a Sermon Image block (if wanted)
* If you are adding sermon details, add a container block and set it's
  class to `wpfc-sermon-main` if you want to pick up Sermon Manager styles
* In this container add main sermon items like the title, the preacher,
  the description, the bible passage or the series.  If you are going to
  not have the user click through to the sermon page to get the media,
  add a sermon media block.  You do not need to set any classes - we
  automatically add the predefined Sermon Manager classes for styling.
* If you want other sermon meta data, why not add another container to
  group your less prominent meta data, and potentially use the container
  styling to give it a different background.
* You can then also add meta data fields, like date, topic, bible book
* You can use the prefix and suffix fields in each attribute to add in
  labels for the fields, if you wish. Click in the prefix or suffix text
  you add and use the floating menu to set to bold or italic or whatever.
* You can then style each container or field as you wish to get the
  results you want.

Providing these blocks gives you infinite flexibility in the layout of the
lists of sermons you want to produce - just lay it out yourself! The
suggestion above for containers is only a helpful suggestion!

We also provide a number of Block Patterns for commonly used sermon
layouts - just drag and drop one in, change what details you want, and
it gives you a great shortcut to produce bespoke sermon list layouts.

The Query Loop container will automatically add pagination as needed.

If you want to provide the sermon filter bar, just add the filter bar
block before or after the container holding the query loop.


== License ==

The plugin is released under the GNU General Public License. A
copy of this license can be found at the license homepage or in the top
comment within the `blocks4sm.php` file.


== Frequently Asked Questions ==

= I want to change how the output looks: =

	Some of the look and feel can be changed via editable block attributes
	... try these to see what effect they have.  We'll be adding more
	configuration options in the future.
	
	You can also use CSS to style all blocks - we seek to use all the 
	Sermon Manager css classes and, by adding `.b4sm` as a preceding
	class in your style sheets you can create styles for each part of
	the output of each block using the Sermon Manager classes but without
	impacting other non-block Sermon Manager output.
	
= I have a Block Theme and there are no default templates for Sermon Manager =

	Block themes don't look for Template files in the plugin.  You need
	to create your own Templates in the Full Site Editor for each
	Template needed.
	
	So, in the Full Site Editor, move to the Templates page, and add a 
	new template - the names should be (for each template kind):

		- `archive-wpfc-sermon` - the default sermons listing page
		- `single-wpfc-sermon` - the page for display of single sermons
		- `taxonomy-wpfc-bible-book` - the page to display all sermons with the passage from a given bible book
		- `taxonomy-wpfc-preacher` - the page to display all sermons by a selected preacher
		- `taxonomy-wpfc-series` - the page to display all sermons within a particular series
		- `taxonomy-wpfc-sermon-topics` - the page to display all sermons tagged with a selected topic
		- `taxonomy-wpfc-service-type` - the page to display all sermons preached within a given type of service

	Within these you can use the blocks supplied.
	
	So, for example, you could use (for example) the Sermon Grid
	block preceded by the Sermon Filters block for all but the Single
	Sermon template.  But in the Single Sermon Template you could use
	the Single Sermon Block.
	
	Equally, you could use the sermon field blocks to create custom output
	- for the query loop block just don't choose to use a custom query
	so that the query that causes that template to be chosen will be
	used for the output.
	
	Using the shortcode blocks is possible, but don't use any of the
	custom query attributes - they need to simply show the query data
	that is intended to be output by the template.
	

== Screenshots ==

1. TBD


== Changelog ==

= 1.0.0 =

**2026-09-22**
* Removed remaining WP Plugin Checker raised problems
  Fixed an error where a final parameter was wrongly within a __() function
  Created Language files (no translations at present)
  Add Banner and icon needed by Wordpress
  Readied to submit as a new plugin to Wordpress
  
= 0.0.4 =

**2026-09-08**
* Bug fixes; Produced a proper README.txt file.
  Added new blocks that call through to each ShortCode so that we have
  block versions for each shortcode.
  Centralised repeated code for easier maintenance.
  Fixed some style sheets that were not being correctly picked up.
  Bring constants in Display Sermons shortcode into line with Sermon
  Manager (otherwise default attribute settings are not changed)
  Add ability to all fields to not display a field if the content is
  empty.
  
= 0.0.3 =

**2026-08-18**
* Bump to show compatibility with Wordpress 7.1
  Update all code in single_sermon block to more closely match that in
  the sermon-series-grid block, add in CSS for single sermon block, and
  ensure it is working correcly.

**2026-08-17**
* Updated code to bring the single-sermon block closer to the sermon grid
  block, and to try to resolve why it is failing to display.

= 0.0.2 =

**2026-07-08**
* Added blocks to use within a Query Builder block so that bespoke
  layouts can be created.

= 0.0.1 =

**2025-10-17**
* Initial release - a basic block is tested and working.

