azurecurve ClassicPress Plugins: Contact Forms

ClassicPress PluginsThis is part of the azurecurve ClassicPress Plugins series which introduces the plugins I have available for ClassicPress.

The plugin I am going to cover in this post, is one written specifically for ClassicPress; Contact Forms.

Functionality

A simple contact forms plugin with an options page allowing default settings to be configured; these settings can, in most cases, be overridden when adding a contact form to a page. This plugin supports the use of multiple contact forms on a page.

Contact forms can be placed on pages using the simple-contact-form shortcode which supports the following parameters:

  • id is the only mandatory parameter; a unique id for each contact form on the page must be supplied.
  • send-from-email allows the default send from email address to be overridden.
  • send-from-name allows the default send from email name to be overridden.
  • recipients is a comma separated list of email address which allows the default recipients to be overridden.
  • label-name allows the default label for the name field to be overridden.
  • label-email allows the default label for the email field to be overridden.
  • label-subject allows the default label for the subject field to be overridden.
  • label-message allows the default label for the message field to be overridden.
  • subject allows the default subject for the name field to be overridden. If an empty subject is provided, users can free form type a subject. Multiple subjects to allow picking from a drop down list can be supplied, separated with a |.
  • subject-prefix allows a subject prefix to be added to all subjects when the email is sent and override the default.

Example shortcode usage:

[simple-contact-form id="contact-us" recipients="bob@example.com,jane@example.com" subject="Sales|Support|Accounts" subject-prefix="Contact us from example.com:"]

This plugin is multisite compatible, with options set on a per site basis.

Download

The plugin can be downloaded from my GitHub.

Click to show/hide the azurecurve ClassicPress Plugins Series Index

azurecurve ClassicPress Plugins: Redirect

ClassicPress PluginsThis is part of the azurecurve ClassicPress Plugins series which introduces the plugins I have available for ClassicPress.

The plugin I am going to cover in this post, is one written specifically for ClassicPress ; Redirect.

Functionality

Redirect URIs with a 301 (permanent) or 302 (temporary) redirect; redirects can be edited, toggled on/off and easily deleted if required.

URLS for redirect can be added manually, or you can enable automatic redirect when a permalink is changed.

This plugin is multisite compatible, with options set on a per site basis.

Download

The plugin can be downloaded from my GitHub.

Click to show/hide the azurecurve ClassicPress Plugins Series Index

ClassicPress Petitions – Let Your Voice Be Heard

ClassicPressOne of the things I like about ClassicPress is that, unlike with WordPress, the community can provide feedback which guides the development. This is done via petitions which the community can create, vote for and comment upon.

There have been changes to how petitions are managed, which Viktor Nagornyy discusses on the ClassicPress blog, Petitions Update — Let Your Voice Be Heard; this change was driven by a change in the software used for petitions.

If you’re using ClassicPress and want to help guide development, visit the petitions forum and create, vote or comment on a petition.

Victor’s post has full details of how the petitions process works.

ClassicPress Petitions — Let Your Voice Be Heard

ClassicPressClassicPress started life as a hard-fork of WordPress 4.9; one of the differentiators is the Gutenberg block editor which started by replacing the TinyMCe editor (now generally referred to as the “classic editor”) and is now beig rolled out through other part of a WordPress site.

However, this is just one of the differentiators. One of the largest other differences is the decision making process used by ClassicPress is petition based with the community casting votes instead of a small number of contributors, or even one man, making the decision.

Viktor Nagornyy has a very good write up of the petition process. If you’re a member of the ClassicPress community, or a WordPress user looking for an alternative where you can make a difference, check out the petitions available for voting upon.

ClassicPress 1.3.0 Now Available

ClassicPressEarlier this week, the releae of ClassicPress version 1.3.0 was announced; this release focuses on improving accessibility (a11y) which is a key focus for ClassicPress (both the core itself as well as strongly recommending that developers work with accessibility in mind) and one which has a lot of people switching from WordPress as Gutenberg is less accessible that the editor used in ClassicPress.

The ClassicPress blog has details of all the accessibility improvements as well as the new features, minor changes and fixes.

ClassicPress version 1.3.0 has been a while coming, but there are a few core developers now involved and working on new functionality as well as backporting worthy additions from WordPress. There is already planning, and some changes complete, for the 1.4.0 release so it looks like the project is now picking up some speed.

The ClassicPress Plugin Directory is now live and accepting submissions of plugins developed for ClassicPress and also ones developed for WordPress, but which work with ClassicPress. The next stage in the directory will be integration with the ClassicPress admin which is slated for version 2.

There have been one or two wobbles over the last couple of years, global events have very much not helped, but things are looking a lot brighter with more core developers, plugin developers and others all getting involved and helping the project progress.

ClassicPress Plugin Development: Save an Options Page

ClassicPress PluginsThis post is part of the ClassicPress Plugin Development series in which I am going to look at both best practice for developing plugins and how I approach some requirements as well as some of the functions I commonly use.

Once you have an options page created, you need to create the process to save the options when the user changes them.

The example I am using in this post is from my Remove Revisions plugin which uses a PHP namespace.

namespace azurecurve\RemoveRevisions;

Continue reading “ClassicPress Plugin Development: Save an Options Page”

ClassicPress Plugin Development: Create an Options Page

ClassicPress PluginsThis post is part of the ClassicPress Plugin Development series in which I am going to look at both best practice for developing plugins and how I approach some requirements as well as some of the functions I commonly use.

Anything more than a very simple plugin will hae options which the site administrator will need to be able to change. this means an options page which is added to the settings menu. ClassicPress does have a settings API which can be used; however, I do not use this API as I’ve previously found it to be overly complex and difficult to use, so I roll my own settings pages.

The example in this post are from my Remove Revisions plugin which uses a namespace:

namespace azurecurve\RemoveRevisions;

As I am using a namespace the options page was added in a function simply called display_options; if a namespace wasn’t in use, I’d have used a vedor/plugin prefix and called the function azrcrv_rr_display_options.

The example takes advantage of the page title from the settings menu (which I covered in the last post as well as loading options, which can be done
with defaults or with with multilevel defaults.

Below is a sample of the display_options from Remove Revisions with the controls removed, leaving behind the basic framework of the page, with the header, load of options and then the form with submit button:

/**
 * Display Settings page.
 *
 * @since 1.0.0
 *
 */
function display_options(){

	if (!current_user_can('manage_options')){
        wp_die(esc_html__('You do not have sufficient permissions to access this page.', 'remove-revisions'));
    }
	
	// Retrieve plugin configuration options from database
	$options = get_option_with_defaults('azrcrv-rr');	
	
	?>
	
	<div id="azrcrv-rr-general" class="wrap">
		
		<h1>
			<?php
				esc_html_e(get_admin_page_title());
			?>
		</h1>
		
		<form method="post" action="admin-post.php">
			
			<input type="hidden" name="action" value="azrcrv_rr_save_options" />
			<input name="page_options" type="hidden" value="enable-cron" />
			
			<?php
				//
				wp_nonce_field('azrcrv-rr', 'azrcrv-rr-nonce');
			?>
			
			/*
				your options here
			*/
			
			<input type="submit" name="btn_save" value="<?php esc_html_e('Save Settings', 'remove-revisions'); ?>" class="button-primary"/>
		</form>
	</div>
	<?php
	
}

The hidden input action and the wp_nonce_field is used for the save of the options, which I’ll cover in the next post in this series.

Click to show/hide the ClassicPress Plugin Development Series Index

ClassicPress Plugin Development: Get Options Page Title

ClassicPress PluginsThis post is part of the ClassicPress Plugin Development series in which I am going to look at both best practice for developing plugins and how I approach some requirements as well as some of the functions I commonly use.

Over the last couple of posts in this series, I’ve discussed how options can be loaded and saved, loaded with defaults and loaded with multilevel defaults. Over the next couple of pages, I’m going to show how an options page can be created and the options saved, but first a quick post on how the options page title can be populated.

I’ve seen a lot of plugins where the options page title has been a string which has been echoed. However, when the options page is added to the settings main menu, the first parameter is the page title. So instead of echoing a new string, we can use the get_admin_page_title function to get the title set when the options page was added to the menu.

<h1>
	<?php
		esc_html_e(get_admin_page_title());
	?>
</h1>

As you can see from the example code, above, the call to get_admin_page_title has been wrapped with a esc_html_e to echo and escape the page title.

Click to show/hide the ClassicPress Plugin Development Series Index

ClassicPress Turns 3

ClassicPressIt does’t seem like it, but ClassicPress is now three years old. Many open source projects don;t last very long, but this hard fork of WordPress 4.9 is still going with a new release in beta test at the moment and the version after in planning.

Viktor Nagornyy has written a blog post reviewing what has been accomplished over the last three years, covering topics like improved security and developer experience, removal of some bloat with plans to remove more, creation of an easy migration route for those moving from WordPress and more; all of which you can read about here.

Birthday cake for ClassicPress

ClassicPress is a volunteer effort which welcomes all the help people are able to provide. If you’re already using ClassicPress or looking to leave WordPress, there are a number of ways you can help out, even if youre not a developer:

  • Make a donation to help pay infrastructure costs. They are tax-deductible in the US.
  • If you’re a PHP programmer, please consider contributing to core development. The more core contributors working on the project, the faster it can reach the roadmap goals.
  • If you have WordPress plugins, make them compatible with ClassicPress and mention ClassicPress in your readme.txt file. There are some popular plugins officially supporting ClassicPress, such as Beaver Builder and Shield Security. You should also submit your plugin to the Directory to reach ClassicPress users.
  • If you can translate English text to your native language, help with translations.
  • If you can write, you can help with blog posts for our ClassicPress blog and/or write documentation guides to help others learn ClassicPress.
  • Help promote ClassicPress by writing a blog post on your own blog, or mentioning ClassicPress in your podcast or YouTube channel, or sharing a blog post from the ClassicPress blog to your social media channels.

If you’re unsure how you can help, join the forum or Slack channel. Share your skills and experience, and the community will be happy to help you find a place in the ClassicPress community.

I joined the ClassicPress community in November 2018 and migrated all of my sites to it in February 2019; I then subsequently forked all of my WordPress plugins for ClassicPress. I didn’t just fork them though, I improved the functionality and security of them all, making many improvements with advice and assistance from people in the community. As well as writing the ClassicPress plugins, I’ve also been involved in writing some documentation and guidelines for the ClassicPress Plugin Directory.

It’s the first large open source project with which I’ve been involved and I have found the community vey welcoming and friendly. As ClassicPress starts it’s fourth year, I’m looking forward to continuing as an active member of the community.

Victor’s blog post can be read here.

New ClassicPress Documentation Hub Now Live

ClassicPressThe new ClassicPress Documentation Hub is now live with user and developer guides as well as the Plugins Guidelines for the ClassicPress Plugin Directory, but the big addition is the ClassicPress Code Reference.

The bulk of the work done to build the new site was done by Beda Schmid who also wrote the announcement post on the ClassicPress blog.

The code reference means that developers can now look up any of the 2,814 methods, 2,874 functions, 280 classes and 2,063 hooks from the ClassicPress code instead of having to use the old WordPress code reference which would include all of the Gutenberg additions.

Full details on what has been added to the ClassicPress Documentation Hub can be read in the announcement.