Results 1 to 9 of 9
-
2nd Jul 2012, 05:45 PM #1OPMember
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:
Code:$s_x = floor( ($orig_w - $crop_w) / 2 ); $s_y = floor( ($orig_h - $crop_h) / 2 );
Code:$s_y = 0; //floor( ($orig_h - $crop_h) / 2 );
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; ?>
--------------------------------------------------------------------------------------------------
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>'; }
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
-
3rd Jul 2012, 02:02 AM #2MemberWebsite's:
piplay.megood, thanks
-
3rd Jul 2012, 02:08 AM #3MemberWebsite's:
ihide.infothanks for the tips
KWWH has turned gay. I will not return until Phamous is demoted.
-
3rd Jul 2012, 02:08 PM #4OPMember
New tips added today! If anyone have doubts, feel free to ask!
-
3rd Jul 2012, 04:44 PM #5Respected Member
looking for more
Can you sort out the problem with Facebook javascript problem with the plugins ?
That is, i cant use Facebook like + share + like box at the same time.
-
3rd Jul 2012, 06:39 PM #6Member
hello, Nice thread
i have some, here is one :
Add Google+ button to your posts automatically :
Simply paste the code below into your functions.php file. Once you saved the file, the Google+ button will be automatically displayed below your posts.
Code:add_filter('the_content', 'wpr_google_plusone'); function wpr_google_plusone($content) { $content = $content.'<div class="plusone"><g:plusone size="tall" href="'.get_permalink().'"></g:plusone></div>'; return $content; } add_action ('wp_enqueue_scripts','wpr_google_plusone_script'); function wpr_google_plusone_script() { wp_enqueue_script('google-plusone', 'https://apis.google.com/js/plusone.js', array(), null); }
but am looking for a code that would add a prefix to all the links in my postes, any code or a plugin ?
-
4th Jul 2012, 03:05 PM #7MemberWebsite's:
anadesigns.netHere's another popular one. Remove unnecessary links from header by sticking this in functions.php:
Code:/* remove clutter from head */ 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);
-
4th Jul 2012, 03:20 PM #8OPMember
This is not a Wordpress issue. Could you please provide a link to check this problem?
---------- Post added at 03:20 PM ---------- Previous post was at 03:20 PM ----------
Awesome tip! I've added to the original post.
-
13th Nov 2012, 03:50 PM #9OPMember
New function added: shortcode for YouTube videos.
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 2 users browsing this thread. (0 members and 2 guests)
Similar Threads
-
Help, With Wordpress post shortcodes
By Z_UpLoAdEr in forum Technical Help Desk SupportReplies: 26Last Post: 31st Aug 2012, 11:30 AM -
The 10 Top SEO Tips
By halala4832 in forum Whitehat SEOReplies: 6Last Post: 20th Jul 2012, 11:07 AM -
Wordpress Tips
By Cactus in forum Webmaster DiscussionReplies: 10Last Post: 5th Aug 2010, 01:09 PM
themaPoster - post to forums and...
Version 5.22 released. Open older version (or...