Replaced ClassicPress Cron Job Timing Out

ClassicPressBack in March I blogged about replacing the standard ClasicPress cron job with a system cron running on a schedule. The reason I did this was to improve the efficiency of my sites by having cron called on a schedule rather than every time a page was loaded.

However, I've recently been adding new functionality to my To Twitter plugin and found that scheduled tweets containing images were not working. I did some exploring and discovered that the problem was that cron jobs timeout after 30 seconds and processing one large, or several smaller, image would exceed this timeout.

I then found that an alternative method of calling cron seemed to run much faster and I was no longer having problems with the cron job timing out. This alternative method uses wget:

wget -q -O - https://{your domain}/wp-cron.php?doing_wp_cron >/dev/null 2>&1

The highlighted section should be replaced with your domain.

A re-evaluation of categories and tags in my ClassicPress blog

ClassicPressI started this blog way back in June 2011 and have ended up writing far more blog posts than I ever imagined; this year alone I have written more than 350 posts and this isn't even my highest post count.

Over the years, I've covered a number of subjects for which I have created categories and tags; in fact far, far too many of each have been created. I've been meaning to take a look at them for quite a while (I'm now actively planning what to do).

One of my fellow ClassicPress plugin authors, CodePotent/John Alarcon did a blog post on ClassicPress Categories and Tags Demystified where he takes a thorough look at categories and tags in ClassicPress and how they can best be structured, as well as some of the pitfalls and mistakes to avoid (many of which I have not avoided).

I'm going to take a good read of John's post and finalise my plan for restructuring this site to reduce the number of categories and tags in use, which will hopefully simplify navigation and make things easier to find.

With over 2,300 posts, and several hundred new ones being added every year, I'm not sure how much I can simplify things, but I'm still pretty sure I can make some substantial improvements.

azurecurve ClassicPress Plugins: Events

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

The plugin I am going to cover in this post, is a brand new one written for ClassicPress; Events.

Functionality

Events allows events such as webinars or conferences to be created via a custom post type; categories, excerpt, details, start and end dates and times and a featured image are all supported.

In the options set defaults for the widget and shortcode.

Multiple widgets can be created, each assigned to display a category; settings for title, image size and limit for number of events to list can be set per widget.

The event shortcode accepts three parameters:
* slug to select specific event.
* width to set the size of the featured image.
* height to set the size of the featured image.

Shortcode usage is [event slug="december-2021" width=150 height=150]; all parameters are optional and will use the defaults set via the settings page.

The events shortcode accepts four parameters:
* category to restrict the output to the selected category.
* width to set the size of the featured image.
* height to set the size of the featured image.
* limit to restrict the number of events to display.

Shortcode usage is [events category="webinars" width=150 height=150 limit=5]; all parameters are optional and will use the defaults set via the settings page.

Download

The plugin can be downloaded via my Development site.

azurecurve ClassicPress Plugins: Widget Announcements

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

The plugin I am going to cover in this post, is a brand new one written for ClassicPress; Widget Announcements.

Functionality

Announce holidays, events, achievements and notable historical figures in a widget.

Announcements can be made:

  • One off
  • Monthly
  • Annually
  • Good Friday
  • Easter Sunday
  • Easter Monday
  • Monthly on the nth day (e.g. 2nd Wednesday of every month)
  • Annually on the nth day of the month (e.g. 4th Thursday of November every year)

Announcements are created as a custom post type and can have details, an image, additional text after the image and can be assigned to multiple categories. A widget can be deployed to a sidebar or other widget area and include the announcements from a category.

Download

The plugin can be downloaded via my Development site.

azurecurve ClassicPress Plugins: Snippets

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

The plugin I am going to cover in this post, is a brand new one I've developed to make life easier by allowing the creation of snippets of HTML or other code or CSS; Snippets.

Functionality

Allows snippets of HTML, PHP, JavaScript and CSS to be created; an alternative to using a functions.php file.

Snippets can be used to create re-usable HTML or JavaScript snippets or to create PHP to add_actions or add_filters without needing to add them to the functions.php file or create a plugin.

The following types of snippet can be created:

  • HTML - can be loaded using the shortcode.
  • Internal CSS - automatically added as internal stylesheet.
  • CSS Stylesheet - automatically loaded.
  • Internal JavaScript - automatically added as internal JavaScript.
  • JavaScript File - automatically loaded.
  • PHP - can be loaded using the shortcode.
  • PHP File - automatically loaded.

Shortcode usage is either [snippet id=1013] (where the supplied id value is a snippet post_id) or [snippet slug='hello-world'].

All snippets are loaded only on the site front end; this protects the admin dashboard from white screen errors caused by badly formed PHP.

Download

The plugin can be downloaded via my Development site.

azurecurve ClassicPress Plugins: Taxonomy Order

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

The plugin I am going to cover in this post, is a brand new one I've developed to use on two of my other sies; Taxonomy Order.

Functionality

Set display order of the category and tag taxonomies of posts.

Download

The plugin can be downloaded via my Development site.

azurecurve ClassicPress Plugins: Gallery From Folder

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

The plugin I am going to cover in this post, is a brand new one I've developed to use on two of my other sies; Gallery From Folder.

Functionality

Gallery From Folder is a simple plugin which will read a folder and display a gallery of all thumbnails with links to the original full-size image.

The [gallery-from-folder] shortcode can be provided with either an alt_id parameter referning a specific name, or a post_id for a ClassicPress post.

An example of the shortcode is [gallery-from-folder alt_id="sample-gallery"]

Demo

An examples of this plugin in action can be found on coppr|Distilleries To Visit.

Download

The plugin can be downloaded via my Development site.

ClassicPress plugins from azurecurve

ClassicPress PluginsI created this blog in June 2011 with WordPress and for a couple of years I used plugins created by other people. However, as I started looking for more advanced functionality, I found that there were either no plugins which did what I wanted or, at best, did most of what I wanted, but not everything or things I didn't like.

I'd worked in PHP previously (including writing my own MVC framework), and decided that I would have a go at writing my own WordPress plugins; by December 2018, I had a library of 25 WordPress plugins which are in the WordPress Plugin Repository.

In November 2018, I started looking at ClassicPress, a hard fork of WordPress, as a way of avoiding the new Gutenberg editor introduced in WordPress. In March 2019, I started rewriting the plugins specially for ClassicPress.

Code was improved, security enhanced and new functionality added; in addition, I also wrote several new plugins just for ClassicPress. All of my plugins for ClassicPress are listed below; clicking a tile will take you to my Development site which has details of the plugin:

Add Open Graph TagsAdd Twitter CardsAvatarsBBCodeBreadcrumbsCall-out BoxesCodeComment ValidatorConditional LinksDisplay After Post ContentEventsFiltered CategoriesFlagsFloating Featured ImageFrom TwitterGallery From FolderGet GitHub FileIconsImagesInsult GeneratorLoop InjectionMaintenance ModeMarkdownMobile DetectionMultisite FaviconNearbyPage IndexPost ArchiveRSS FeedRSS SuffixSeries IndexShortcodes in CommentsShortcodes in WidgetsSidebar LoginSnippetsTag CloudTaxonomy IndexTaxonomy OrderTheme SwitcherTimelinesTo TwitterToggle Show/HideUpdate Admin MenuURL ShortenerWidget Announcements

The above list of plugins will automatically update as new plugins are released.

ClassicPress Development with GitHub: Creating release zips

GitHubWhen I started developing plugins for ClassicPress I decided that I needed to be using source control. As ClassicPress is intending to use GitHub for their plugin directory, it made sense for me to use it as well. This post is part of a series on ClassicPress Development with GitHub.

In the last post of this series, when discussing creating a release, I mentioned that you should upload a zip file containing the release code.

While users can download the source code directly, this will leave -master on the folder name. By creating a release zip, you can avoid this.

I have developed quite a few plugins for ClassicPress and have instances where I make changes to several plugins for release at the same time. To make this easier, I have a Windows batch command which will call 7-zip to compress all folders, in the same folder as the batch file, as zip files:

for /d %%X in (*) do "c:\Program Files\7-Zip\7z.exe" a -xr!.git\ -xr!*~ "%%X.zip" "%%X\"

I didn't create this command line statement all on my own, but think I might have added the argument to exclude files with a .git suffix. Unfortunately, I started using it a few months ago and do not remember from where the original script came.

ClassicPress Development with GitHub: Create Release

GitHubWhen I started developing plugins for ClassicPress I decided that I needed to be using source control. As ClassicPress is intending to use GitHub for their plugin directory, it made sense for me to use it as well. This post is part of a series on ClassicPress Development with GitHub.

When developing with GitHub, you can make a release; this is a way of grouping together all of the changes since the last release to make it easy to download that particular code set. One point to note, is that while GitHub will automatically create a zip of the source code, this isn't suitable to use for a ClassicPress release as it will include -master in the contained directory name. However, you can upload a zip file containing the code in the correct folder.

To create a new release, load the repository page on GitHub and click the releases button (red ringed):

Repository page

Continue reading "ClassicPress Development with GitHub: Create Release"