Office Address

41/D, West Brahmondi, Narsingdi

Phone Number

+880-1975374887

Email Address

[email protected]

Here is a list of some useful WordPress functions.This may reduce your development time.

wp_mail()

Some time we need to send email to the user.We can use this wordpress function wp_mail() to send email.It works just like the php email function but have better functionality.

wp_loginout()

Displays a login link, or if a user is logged in, displays a logout link.You can even give the redirect url here.SO user will redirect to that url.

esc_url()

This function ejects URLs that do not have one of the provided whitelisted protocols (defaulting to http, https, ftp, ftps, mailto, news, irc, gopher, nntp, feed, and telnet), eliminates invalid characters, and removes dangerous characters.

is_page()

With this function you can check if that particular page is being load.Very handy if you want to load a script only a specific page

Disable Commenting on Posts Older Than 1 Month:

[php] <?php

function close_comments( $posts ) {

if ( !is_single() ) { return $posts; }

if ( time() – strtotime( $posts[0]->post_date_gmt ) > ( 30 * 24 * 60 * 60 ) ) {
$posts[0]->comment_status = ‘closed’;
$posts[0]->ping_status = ‘closed’;
}

return $posts;
}
add_filter( ‘the_posts’, ‘close_comments’ );

?>
[/php]

Custom Excerpt Length:

[php] function new_excerpt_length($length) {
return 100;
}
add_filter(‘excerpt_length’, ‘new_excerpt_length’);
[/php]
Written by

Maidul Islam

I am a freelance web developer.Like to share what i learn.