Category

WordPress theme Silverbird and updates (fork)

10 Dec 2020 20:38 | Geplaatst door Marcel

The WordPress theme Silverbird from WP3Layouts is in my opinion a nice, simple and rather clean theme. It was first released in 2018 and saw a few updates in the next few months. After that it dried up.
There is also a Pro version for sale, but I don’t really need features in a theme, that is what plugins are for.

I do use the theme myself, but saw that it didn’t work in WordPress 5.6 anymore, due to jQuery updates. It does work with PHP 8, which is quite nice.
I don’t expect any updates coming from the original author.
I forked the theme as Silverbird Lite, which is now available on Codeberg. I don’t intend to do much with it, just keep it in working state. I did remove a few things, like Google Fonts, since I don’t like my visitors being tracked by Google.

The first changelog looks like this:

  • = 1.1.0 =
  • 2020-12-10
  • Rename to Silverbird Lite.
  • Tested on WP 5.6 and PHP 8.
  • Fix preloader and disable it by default.
  • Update Bootstrap.js from 3.3.6 to 3.4.1.
  • Remove old modernizr 2.6.2.
  • Remove Support tab in Customizer.
  • Remove Google Fonts, there are plugins for that.
  • Remove Google Plus from social media links.
  • Remove Swipebox, you might prefer your own image modal.
The WordPress theme Silverbird from WP3Layouts is in my opinion a nice, simple and rather clean theme. It was first released in 2018 and saw a few updates in the next few months. After that it dried up. There is…
Read more...

How to create a Custom Provider for XML Sitemaps in WordPress 5.5

20 Jun 2020 20:27 | Geplaatst door Marcel

WordPress 5.5 will be released in August 2020 and the feature plugin for XML Sitemaps has been merged this June. You can read about the original proposal on the development blog make/core.

This feature generates a `sitemap.xml` in the document root to make it more easy for search engines to index your website.
It will list all pages, posts, tags, categories and users. It also includes support for Custom Post Types and Custom Taxonomies. You can also extend it to index custom datatypes. That could be from a custom plugin that uses its own database table and its own functions to display that.

This blogpost is about creating a custom provider for your own data.
Please understand that for custom post types or taxonomies you don’t have to do anything.

First you create a custom provider, that will generate pagination and the url_list.

/**
 * Get set of sitemap link data.
 *
 * @since 5.5.0 (use your plugin version)
 */
if ( class_exists( 'WP_Sitemaps_Provider' ) ) {

class WP_Sitemaps_My_Plugin extends WP_Sitemaps_Provider {

	/**
	 * WP_Sitemaps_My_Plugin constructor.
	 *
	 * @since 5.5.0 (use your plugin version)
	 */
	public function __construct() {
		// Use ofcourse your own names here.
		$this->name        = 'plugin_prefix';
		$this->object_type = 'plugin_prefix';
	}


	/**
	 * Gets a URL list for a sitemap.
	 *
	 * @since 5.5.0 (use your plugin version)
	 *
	 * @param int    $page_num       Page of results.
	 * @param string $object_subtype Optional. Default empty.
	 *
	 * @return array $url_list Array of URLs for a sitemap. 
	 */
	public function get_url_list( $page_num, $object_subtype = '' ) {
		// use a function from your plugin to fetch this data
		$pages = plugin_prefix_get_url_list();

		$url_list = array();
		foreach ( $pages as $page ) {

			// No need to add 'lastmod', it is only a hint to search engines.
			$sitemap_entry = array(
				'loc'     => $page,
			);

			$url_list[] = $sitemap_entry;
		}

		return $url_list;

	}


	/**
	 * Gets the max number of pages available for the object type.
	 *
	 * @since 5.5.0 (use your plugin version)
	 *
	 * @see WP_Sitemaps_Provider::max_num_pages
	 *
	 * @param string $object_subtype Optional. Default empty.
	 *
	 * @return int Total page count.
	 */
	public function get_max_num_pages( $object_subtype = '' ) {
		// again, use a function from your own plugin to fetch this data.
		$pages = plugin_prefix_get_my_pagination();

		return count( $pages );

	}
}
}

This is all for the Custom Provider that you need. I do hope you understand that you need to code your own pagination and your list of urls :)

Now to integrate it with the Sitemaps in WordPress 5.5 you can use 2 ways.
First option is to use a filter and add the instance of your Provider class.

function plugin_prefix_wp_sitemaps_register_providers( $providers ) {

	if ( class_exists( 'WP_Sitemaps_Provider' ) ) {
		$provider = new WP_Sitemaps_My_Plugin();
		$providers['plugin_prefix'] = $provider;
	}

	return $providers;

}
add_filter( 'wp_sitemaps_register_providers' , 'plugin_prefix_wp_sitemaps_register_providers' );

The other option is to call a procedural function call in an action hook.

function plugin_prefix_wp_sitemaps_register_providers() {

	if ( function_exists('wp_register_sitemap') && class_exists( 'WP_Sitemaps_Provider' ) ) {
		$provider = new WP_Sitemaps_My_Plugin();
		wp_register_sitemap( 'plugin_prefix', $provider );
	}

}
add_action( 'init', 'plugin_prefix_wp_sitemaps_register_providers' );

Both these hooks to register your custom provider should end up the same.

WordPress 5.5 will be released in August 2020 and the feature plugin for XML Sitemaps has been merged this June. You can read about the original proposal on the development blog make/core. This feature generates a `sitemap.xml` in the document…
Read more...

Updates for the Jednotka WordPress theme

17 Feb 2019 13:27 | Geplaatst door Marcel

The Jednotka WordPress theme was for some time quite a popular theme for WordPress. However, the last update for it was published in December 2014, and there were no more subsequent updates. That basically meant it wasn’t compatible with PHP 7, and it broke down on anything that recent.

Up untill October 2018 it was still for sale on that Envato website. To me that was quite in bad taste. People would buy a theme that wasn’t even working on current PHP versions. Apparently that is how you make money, by cheating people out of it.

Last October I met someone at a local WordPress meetup who was using the Jednotka theme on het website, but had problems with it. A lot of admin pages broke down and the WordPress dashboard was quite useless.

I helped her with a few bugfixes and updates for the this theme that make it work with PHP 7.1 and 7.2. You can find that updated theme over at Codeberg.

The Jednotka WordPress theme was for some time quite a popular theme for WordPress. However, the last update for it was published in December 2014, and there were no more subsequent updates. That basically meant it wasn’t compatible with PHP…
Read more...

How to create a personal calendar with WordPress

19 Apr 2017 14:00 | Geplaatst door Marcel

For the last few years I have used Owncloud, which is a full-featured hosting solutions for files, contact, calender, etc. It turned out I only use the calendar part of it, and found the complexity of that full suite a bit too much. Upgrading always gave me issues. I was planning to switch to Nextcloud, which is basically the same thing, but I decided against that. If I am switching anyway, I could just as well switch to something more to the point and with simplicity included.

First I played with a real calendering server, Radicale. I combined that with a web GUI in the form of AgenDAV. Both simple implementations and seemingly what I wanted. But I had some integration issues, not everything worked right, like moving items to a different day, or editing an existing item.

So I started looking for a WordPress solution. All I need in a calendar solution is:

  • Simple interface per month with tiles for each day.
  • Frontend editing.
  • Only one user.
  • Each item has just a day and title. A color per category would be a nice extra.
  • Authentication with a user/password form.

What I do not need:

  • Multiple users.
  • Public or shared calendars.
  • Contacts.
  • Vcards, caldav, ical integration.
  • Shared files.

Plugins

I found the Calendar Event Multi View plugin to best fit my needs. You can easily add a shortcode with a calendar to a page, in my case the frontpage of the site. It is also easy to enable frontend editing. It just works the way I was looking for.

Theme

The theme I made a child theme for was Twenty Sixteen. I called it Personal Calendar and it is available on Codeberg. It has some custom CSS and adds a grey Calendar color scheme to Twenty Sixteen.
The page template has a login form for non-logged-in users, and after login shows the calender.
Everything else has been stripped from the templates and it is all simply aimed at being a good calender theme.

Result

The result is just a one page design with a calendar on the frontend of that site. It lives on a personal subdomain.

screenshot of personal calender
screenshot of personal calender
For the last few years I have used Owncloud, which is a full-featured hosting solutions for files, contact, calender, etc. It turned out I only use the calendar part of it, and found the complexity of that full suite a…
Read more...

Gwolle Guestbook WordPress plugin

19 Mar 2015 15:44 | Geplaatst door Marcel

Gwolle-GB is a nice WordPress plugin for a guestbook. It was unmaintained for a long time however. Recently at my previous job the hosting switched from mysql to mysqli, and the plugin stopped working.

In September 2014 I started to maintain this plugin. A lot of code has been rewritten, and features have been added. The todo-list is now getting shorter, so it seems quite good now.

Gwolle-GB is a nice WordPress plugin for a guestbook. It was unmaintained for a long time however. Recently at my previous job the hosting switched from mysql to mysqli, and the plugin stopped working. In September 2014 I started to…
Read more...

New version cPanel plugin

16 Apr 2013 09:28 | Geplaatst door Marcel

Today I released a new version of the WordPress installer for cPanel. It has quite changed, therefore I called it version 2.0. It has support for more languages, and you can easily add your own. Also the security has improved, you can only change the path now.

Today I released a new version of the WordPress installer for cPanel. It has quite changed, therefore I called it version 2.0. It has support for more languages, and you can easily add your own. Also the security has improved,…
Read more...