Advertisement
jan_dembowski

jiathis-home.php

Nov 11th, 2012
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.02 KB | None | 0 0
  1. <?php
  2. /*
  3. Plugin Name: Add JiaThis to the home page too
  4. Version: 0.1
  5. From http://wordpress.org/support/topic/add-content-under-post-on-main-page?replies=8
  6. */
  7.  
  8. add_filter( 'the_content', 'mh_jiathis' , 20 );
  9.  
  10. function mh_jiathis($content) {
  11.         $jiathis_code = get_option('jiathis_code');
  12.         $jiathis_dir = 'float:'.get_option('jiathis_dir');
  13.         $jiathis_clear = '<div style="clear:both; margin-top:5px; margin-bottom:5px;"></div>';
  14.     // if(is_single() || is_page() && get_option('jiathis_feed') == 'yes') {
  15.     if( is_home() && get_option('jiathis_feed') == 'yes') {
  16.                 if(get_option('jiathis_pos') == 'down') {
  17.                         $content = $content.$jiathis_clear."<div style=\"".$jiathis_dir."\">".$jiathis_code.'</div>'.$jiathis_clear;
  18.                 } else if(get_option('jiathis_pos') == 'up') {
  19.                         $content = $jiathis_clear."<div style=\"".$jiathis_dir."\">".$jiathis_code.'</div>'.$jiathis_clear.$content;
  20.                 }
  21.         }
  22.         return $content;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement