Customize WordPress Tag Cloud Widget

Terakhir diperbaharui: Kamis, 25 Agustus 2016 pukul 15:12
Tautan: http://darto.id/2z

There are plenty of ways of adding a custom widget, or hacking WordPress core files to achieve what I needed but that isn’t very efficient; especially when it comes time to update the WordPress install.

Instead, I took advantage of filters, specifically widget_tag_cloud_args. You can find the different parameters for the wp_tag_cloud in the Codex since that’s what we’ll be working with here.

Open up your themes functions.php file and add the following:

Changing the Smallest and Largest Font Sizes

By default, the tag cloud displays tags by point (pt); the smallest being 8pt and the largest being 22pt. Let’s change that to 10px and 18px respectively:

function custom_tag_cloud_widget($args) {
	$args['largest'] = 18; //largest tag
	$args['smallest'] = 10; //smallest tag
	$args['unit'] = 'px'; //tag font unit
	return $args;
}
add_filter( 'widget_tag_cloud_args', 'custom_tag_cloud_widget' );

 

Changing the Total Number of Tags to Display

By default the WordPress tag cloud only shows 45 tags. We can change that to display a specific number or all tags by adding the following to the function we added above:

function custom_tag_cloud_widget($args) {
	$args['number'] = 0; //adding a 0 will display all tags
	$args['largest'] = 18; //largest tag
	$args['smallest'] = 10; //smallest tag
	$args['unit'] = 'px'; //tag font unit
	return $args;
}
add_filter( 'widget_tag_cloud_args', 'custom_tag_cloud_widget' );

 

Changing the Tag Cloud Format

By default the tag cloud displays tags in a flat format seperated by whitespace. Let’s change that to an unordered list with a class of wp-tag-cloud:

function custom_tag_cloud_widget($args) {
	$args['number'] = 0; //adding a 0 will display all tags
	$args['largest'] = 18; //largest tag
	$args['smallest'] = 10; //smallest tag
	$args['unit'] = 'px'; //tag font unit
	$args['format'] = 'list'; //ul with a class of wp-tag-cloud
	return $args;
}
add_filter( 'widget_tag_cloud_args', 'custom_tag_cloud_widget' );

 

Exclude Tags from the Tag Cloud

We can also exclude tags from showing up in the tag cloud by adding the following:

function custom_tag_cloud_widget($args) {
	$args['number'] = 0; //adding a 0 will display all tags
	$args['largest'] = 18; //largest tag
	$args['smallest'] = 10; //smallest tag
	$args['unit'] = 'px'; //tag font unit
	$args['format'] = 'list'; //ul with a class of wp-tag-cloud
	$args['exclude'] = array(20, 80, 92); //exclude tags by ID
	return $args;
}
add_filter( 'widget_tag_cloud_args', 'custom_tag_cloud_widget' );

 

Add Custom Taxonomies to the Tag Cloud

By default the tag cloud only shows the post_tag taxonomy. Let’s also add a custom taxonomy called ‘ingredients’:

function custom_tag_cloud_widget($args) {
	$args['number'] = 0; //adding a 0 will display all tags
	$args['largest'] = 18; //largest tag
	$args['smallest'] = 10; //smallest tag
	$args['unit'] = 'px'; //tag font unit
	$args['format'] = 'list'; //ul with a class of wp-tag-cloud
	$args['exclude'] = array(20, 80, 92); //exclude tags by ID
	$args['taxonomy'] = array('post_tag', 'ingredients'); //add post tags and ingredients taxonomy
	return $args;
}
add_filter( 'widget_tag_cloud_args', 'custom_tag_cloud_widget' );

Pretty simple, no?

 

source: designpx

AppCleaner

Terakhir diperbaharui: Kamis, 25 Agustus 2016 pukul 15:12
Tautan: http://darto.id/30

AppCleaner is a small application which allows you to thoroughly uninstall unwanted apps.

Installing an application distributes many files throughout your System using space of your Hard Drive unnecessarily.
AppCleaner finds all these small files and safely deletes them.

Simply drop an application onto the AppCleaner window. It will find for the related files and you can delete them by clicking the delete button.

Pengajian Meresahkan Warga

Terakhir diperbaharui: Kamis, 25 Agustus 2016 pukul 15:12
Tautan: http://darto.id/31

Pelapor: “Pak Polisi, di daerah kami ada pengajian Salafy. Tolong dibubarkan karena meresahkan warga.”

Polisi: “Meresahkan gimana? Memang mereka nyetel musik nyaring2?”

Pelapor: “Gak Pak. Kata mereka musik itu haram.”

Polisi: “Terus? Oh, saya tahu. Pasti mereka ngajak demo ya?”

Pelapor: “Gak Pak. Kata mereka kita harus ta’at pada pemerintah Muslim.”

Polisi: “Atau tawuran?”

Pelapor: “Gak Pak. Mereka bilang haram mengacungkan senjata ke orang Islam.”

Polisi: “Ngajakin ngebom ya?”

Pelapor: “Bukan juga, Pak. Katanya membunuh kafir non-Harby itu haram.”

Polisi: “Oooh. . . Pasti mereka lagi pesta sex?”

Pelapor: “Bapak jangan ngawur, wong wanitanya ada ruangan sendiri.”

Polisi: “Biasanya pengajian meresahkan itu karena dzikir berjamaahnya pake mikrofon?”

Pelapor: “Gak Pak. Kata mereka itu bid’ah!”

Polisi: “Apa suara kasidahan ibu2nya jelek?”

Pelapor: “Sudah saya bilang mereka gak suka nyanyi!”

Polisi: “Terus? Kenapa mesti saya bubarkan?”

Pelapor: “Karena begini, Pak. Karena mereka itu. . . . Karena. . . . Begini lho. . . . Hmmm. . . Apa ya?”

Polisi: “Bapak silahkan buat laporan yang jelas dulu. Allah berfirman, “La taqfu ma laysa laka bihi ‘ilm”. Jangan mengikuti apa yang kamu tidak tahu ilmunya.”

Pelapor: “Wah, ternyata bapak pinter agama, hafal ayat juga. Ikut kajian dimana, Pak?”

Polisi: “Kajian Salafy.

Dia – Diagram Editor

Terakhir diperbaharui: Kamis, 25 Agustus 2016 pukul 15:12
Tautan: http://darto.id/32

Dia is free (open source) drawing software. Sketch your favorite structured diagrams!. The current Dia release has been tested successfully on Windows 8.1, 8, 7, Windows Vista and Windows XP, Linux and Mac OS X.

Convert m4a to mp3 with iTunes

Terakhir diperbaharui: Kamis, 25 Agustus 2016 pukul 15:12
Tautan: http://darto.id/33

I use iTunes 11.3.1.2 to convert m4a (voice memos) to mp3.

Open iTunes and go to Preferences by click little box at left top iTunes.

iTunes Preferences

At General Preferences click Import Settings…

General Preferences

And choose Mp3 Encoder.

Import Settings

And then back to iTunes Music and right click to file or song that you want convert to mp3.

Convert m4a to mp3

And thats it, your file just converted to mp3.

Automatically Disable Trackpad when Using Mouse

Terakhir diperbaharui: Kamis, 25 Agustus 2016 pukul 15:12
Tautan: http://darto.id/36

Mac notebooks: Enabling the “Ignore trackpad when mouse or wireless trackpad is present” feature

The option to enable or disable “Ignore trackpad when mouse or wireless trackpad is present” on your Mac notebook can be found in System Preferences:

OS X v10.7 Lion or OS X Mountain Lion v10.8

  1. From the Apple () menu, choose System Preferences.
  2. From the View menu, choose Accessibility.
  3. Click the Mouse & Trackpad pane.

OS X v10.6 Snow Leopard

  1. From the Apple () menu, choose System Preferences.
  2. From the View menu, choose Universal Access.
  3. Click the Mouse & Trackpad pane.

mouse_trackpad

 

As far I search on Windows, they don’t have this most wanted feature, on Windows we have to disabled manually.

Remove HTML Comments at Web Source on WordPress Site

Terakhir diperbaharui: Kamis, 25 Agustus 2016 pukul 15:12
Tautan: http://darto.id/37

When viewing the source of your WordPress website, you may notice that there are a lot of HTML comments sitting there for no reason. HTML comments are not visible on the actual page and in some cases are there to help developers but are no longer needed within the code. A good plugin to use to help cleanup your site’s coding and remove any HTML comments is Head Cleaner, this plugin also gives you the option to remove any unwanted meta tags, javascript and css.

But if you don’t want to go down the plugin route, and just want a simple fix to put into your functions.php file, here it is…

function callback($buffer) {
    $buffer = preg_replace('/<!--(.|s)*?-->/', '', $buffer);
    return $buffer;
}
function buffer_start() {
    ob_start("callback");
}
function buffer_end() {
    ob_end_flush();
}
add_action('get_header', 'buffer_start');
add_action('wp_footer', 'buffer_end');

Depending on the size of your site, how many plugins you have and your server setup, this can be a little memory intensive and might raise your server’s load.

 

source: cazue

Changing WordPress Feed Links with Feedburner

Terakhir diperbaharui: Kamis, 25 Agustus 2016 pukul 15:12
Tautan: http://darto.id/38

So, you’ve set up a Feedburner account, but you don’t know how to point your feeds to it correctly. The best method is to change this within your .htaccess file, but some bloggers might not be very comfortable fiddling with it or might not even be able to access it through FTP (depending on hosting environment).

What I’ll show you is a simple way to change all of your feed links without having to dig through a bunch of code in all of your theme and plugin files. This is also a great method for theme authors that allow users to input a custom feed URL through a theme settings page.

Before moving on, I do recommend using Perishable Press’ method of redirecting feeds through htaccess.

 

Using your theme’s functions.php to change feed links

The first thing we need to do is open our theme’s functions.php file.

What we’ll do from this point is change our main feeds to point to our Feedburner account:

add_filter('feed_link','custom_feed_link', 1, 2);

function custom_feed_link($output, $feed) {

	$feed_url = 'http://feeds.feedburner.com/justintadlock';

	$feed_array = array('rss' => $feed_url, 'rss2' => $feed_url, 'atom' => $feed_url, 'rdf' => $feed_url, 'comments_rss2' => '');
	$feed_array[$feed] = $feed_url;
	$output = $feed_array[$feed];

	return $output;
}

That points all of our main RSS and Atom feeds to Feedburner.

As I’ve said, the htaccess method is the best way to ensure your feeds are being directed to the proper place. The method described above does nothing more than change the output of your feed links.

The most practical application of this is for theme authors to help their users by adding in this option on the theme settings page.

And yes, I know there are plugins that handle feeds, but I don’t much see a point in using a plugin for simple tasks.

Also, check out this great collection of 10 RSS tips for WordPress by Jean-Baptiste Jung.

 

source: justintadlock