Sort Archive Posts Alphabetically

I recently worked on a documentation project that required posts to be sorted alphabetically by title. The process can be done by using pre_get_posts() and the is_archive() conditional tag.

/*
 * Order post archives by title in descending order
 */
add_action( 'pre_get_posts', 'jd_archive_sort_alpha_title'); 

function jd_archive_sort_alpha_title($query){

	if(is_archive()) {

		// Set the order to ascending order
		$query->set( 'order', 'ASC' );

		// set the orderby to title
		$query->set( 'orderby', 'title' );

	}

};

As always if you want to use this plugin on your website test it first in a safe environment to verify that it doesn’t create a conflict. Happy hacking. 🙂

Private Notes

The Private Notes WordPress plugin is in active development, I’m providing it here for the public to hack, tweak and learn from… Use at your own risk.

Private Notes allows users create and store notes on their personal website.

How Private Notes works

The Plugin creates a Notes section within the dashboard where you can create and maintain your notes.

A Custom Post Type is created to hold your content.

These notes are visible when logged into your website while the content remains hidden from a public guest who could be viewing the page.

What users can see when they’re logged in.
An example of what the public would see if they visit the post

Important

The post’s title, author, date and other data will remain visible to the public. Additionally any media files such as images, videos, audio, and documents will remain visible from their attachment pages. Private Notes does not secure any files attached to the post! It only hides the post’s content area.

Creating a Private Note

After activating the private Private Notes plugin a notebook icon will appear in your admin menu under Posts. Simply Add New, type out some notes, add media, links, embeds or whatever you like. Then hit publish.

The Post Editor of a Note
The Post Editor of a Note

Although self hosting notes in WordPress isn’t as convenient as a dedicated note taking app it does allows personal control and ownership of my thoughts.

Dequeue Google Maps API for Events Calendar Pro

After Google started requiring information to obtain an API I realized I had no practical need for the API as all my events tend to be in the same location.

With the help from Modern Tribe support I created the following plugin. Once activated it will remove the API call to Google Maps. Likewise deactivating or deleting the plugin will restore Event Calendar Pro’s default behavior.

Plugin: Remove Google Maps API for ECP

Alphabetize All Categories Except News & Events plugin

After writing my previous post where I alphabetize all categories site wide except the ‘news-events’ slug it seemed appropriate to do the same thing as a very simplified plugin. Everything from that post remains the same except I’ve added a plugin header to provide information to WordPress about the plugin.

Continue reading “Alphabetize All Categories Except News & Events plugin”