In this thread I will post some Wordpress shortcodes that will help you in websites development.

This thread will be always updated, so keep it bookmarked!

How to change post thumbnail crop position in wordpress:
- Open media.php file under wp-includes folder.
- Find the function named “image_resize_dimensions” (Around line 309). Unfortunately this function is not pluggable and doesn’t use any hooks so we will edit it directly. Find the lines:

Code: 
$s_x = floor( ($orig_w - $crop_w) / 2 );
$s_y = floor( ($orig_h - $crop_h) / 2 );
Change the second line to

Code: 
$s_y = 0; //floor( ($orig_h - $crop_h) / 2 );
Save the file and upload it to wp-includes folder.

Source: http://shailan.com/781/how-to-change...-in-wordpress/

--------------------------------------------------------------------------------------------------

How to disable text editor in Wordpress:

Place this code in your functions.php file.

Code: 
add_action('init', 'my_remove_editor_from_post_type');
    function my_remove_editor_from_post_type() {
        remove_post_type_support( 'post', 'editor' );
    }
--------------------------------------------------------------------------------------------------

How to get Featured Image URL:

In some cases in just want the URL of a featured image, for this, you can use this code:

Code: 
<?php if (has_post_thumbnail( $post->ID ) ): ?>
<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
    <?php echo $image[0]; ?>
<?php endif; ?>
Remember to change the "single-post-thumbnail" to the size you want. You can use: full, medium or thumbnail.

--------------------------------------------------------------------------------------------------

Removing trash from <head>:

By default, Wordpress add a lot of code inside your <head> that probably you will never use. To remove it, place this code inside your functions.php:

Code: 
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'feed_links', 2);
remove_action('wp_head', 'index_rel_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'feed_links_extra', 3);
remove_action('wp_head', 'start_post_rel_link', 10, 0);
remove_action('wp_head', 'parent_post_rel_link', 10, 0);
remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0);
--------------------------------------------------------------------------------------------------

Shortcode for YouTube videos:

Place this code on your functions.php.

Code: 
add_shortcode( 'youtube', 'youtube' );
function youtube( $atts, $content = null ) {
    return '<p itemprop="video"><iframe width="640" height="350" src="http://www.youtube.com/embed/'.$content.'?theme=light&autohide=1&showinfo=0;wmode=opaque;border=none;iv_load_policy=1" frameborder="0" allowfullscreen></iframe></p>';
}
Usage:
Code: 
[ youtube]VIDEOID[/youtube]
bjskid Reviewed by bjskid on . Wordpress Tips and Shortcodes In this thread I will post some Wordpress shortcodes that will help you in websites development. This thread will be always updated, so keep it bookmarked! How to change post thumbnail crop position in wordpress: - Open media.php file under wp-includes folder. - Find the function named “image_resize_dimensions” (Around line 309). Unfortunately this function is not pluggable and doesn’t use any hooks so we will edit it directly. Find the lines: $s_x = floor( ($orig_w - $crop_w) / Rating: 5