Category: Code

How to use wp_kses function

<?php
 $copyright = get_theme_mod('kotha_footer_copyright');

 $allowed_tags = array(
    'strong' => array(),
    'a' => array(
       'href' => array(),
       'title' => array()
    )
 );
 echo wp_kses( $copyright, $allowed_tags ); ?>

More info

SubFolder WordPress Permalink not working on Nginx?

Open your terminal and login your server.

sudo nano /etc/nginx/sites-available/example.com

add location

        location /subfolder/ {
                try_files $uri $uri/ /subfolder/index.php?$args;
        }

and restart nginx

sudo service nginx restart

How to limit letter of WordPress post title

How to limit letter of WordPress post title? Just replace this code

<?php the_title(); ?>

with the following code.

<?php if (strlen($post->post_title) > 35) {
echo substr(the_title($before = '', $after = '', FALSE), 0, 35) . '...'; } else {
the_title();
} ?>

This code is very helpful to limit WordPress post title.