Different number of posts in each category

As @StephenHarris pointed out there’s also the pre_get_posts filter. function hwl_home_pagesize( $query ) { if ( is_category( 9 ) ) { // If you want “posts per page” $query->query_vars[‘posts_per_page’] = 1; return; } if ( is_category( ‘movie’ ) ) { // If you want “showposts” $query->query_vars[‘showposts’] = 50; return; } } add_action( ‘pre_get_posts’, ‘hwl_home_pagesize’, 1 … Read more

Customizing get_the_excerpt() to specific length and “Read More” output.

To get a specific length you can use: wp_trim_words function. It has 3 parameters. Text to trim. Ex: get_the_content() Number of words. Ex: 295 What to append after end of the text. Ex: ” This means null. Use this: <span> <?php echo wp_trim_words( get_the_content(), 295, ” ); ?> <i><a style=”color:#1975D1;float:Right;” class=”title” href=”https://wordpress.stackexchange.com/questions/75069/<?php the_permalink() ?>” rel=”bookmark”>Click … Read more

Decrease file size upload in Media

That number is taken from wp_max_upload_size(), and there is a filter: ‘upload_size_limit’. See wp-admin/includes/template.php. So this should work (not tested): add_filter( ‘upload_size_limit’, ‘wpse_70754_change_upload_size’ ); function wpse_70754_change_upload_size() { return 1000 * 1024; }

Changing the username character limit from four to less characters

You can filter ‘wpmu_validate_user_signup’ and check if the error code matches the 4 character warning. Then just unset the error code. Sample plugin: <?php # -*- coding: utf-8 -*- /* Plugin Name: Allow short user names for multi site. */ add_filter( ‘wpmu_validate_user_signup’, ‘wpse_59760_short_user_names’ ); /** * Allow very short user names. * * @wp-hook wpmu_validate_user_signup … Read more

Remove more or […] text from short post

The codex is your friend and should be your first stop 🙂 The […] is added by the_excerpt(). There is a filter supplied called the excerpt_more filter that is specifically included to customize the read more text after the excerpt To remove the […] after the excerpt text, you can do the following function new_excerpt_more( … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)