[ Index ]

PHP Cross Reference of PageLines Framework

title

Body

[close]

/includes/ -> library.wordpress.php (source)

   1  <?php
   2  
   3  /**
   4   * Gets Comments Link based on ID
   5   */
   6  function pl_get_comments_link( $post_id ){
   7  
   8      $num_comments = get_comments_number($post_id);
   9       if ( comments_open() ){
  10             if($num_comments == 0){
  11                   $comments = __('Add Comment', 'pagelines');
  12             }
  13             elseif($num_comments > 1){
  14                   $comments = $num_comments.' '. __( 'Comments', 'pagelines' );
  15             }
  16             else{
  17                    $comments ="1 Comment";
  18             }
  19       $write_comments = '<a href="' . get_comments_link($post_id) .'">'. $comments.'</a>';
  20       }
  21      else{$write_comments =  '';}
  22  
  23      return $write_comments;
  24  
  25  }
  26  
  27  /**
  28   * Get just the WordPress thumbnail URL - False if not there.
  29   */
  30  function pl_the_thumbnail_url( $post_id, $size = false ){
  31  
  32      if( has_post_thumbnail($post_id) ){
  33  
  34          $img_data = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), $size, false);
  35  
  36          $a['img'] = ($img_data[0] != '') ? $img_data[0] : '';
  37  
  38          return $a['img'];
  39  
  40      } else
  41          return false;
  42  }
  43  
  44  /**
  45   * Support optional WordPress functionality 'add_theme_support'
  46   */
  47  add_action('after_setup_theme', 'pl_theme_support');
  48  
  49  /**
  50   *
  51   * @TODO document
  52   *
  53   */
  54  function pl_theme_support(  ){
  55  
  56      add_theme_support( 'post-thumbnails' );
  57      add_image_size( 'aspect-thumb', 900, 600, true );
  58      add_image_size( 'basic-thumb', 400, 400, true );
  59      add_image_size( 'landscape-thumb', 900, 450, true );
  60      
  61      add_theme_support( 'menus' );
  62      add_theme_support( 'automatic-feed-links' );
  63      
  64      add_theme_support( 'woocommerce' );
  65  
  66  }
  67  
  68  /**
  69   *  Fix The WordPress Login Image URL
  70   */
  71  add_filter('login_headerurl', 'fix_wp_login_imageurl');
  72  
  73  /**
  74   *
  75   * @TODO document
  76   *
  77   */
  78  function fix_wp_login_imageurl( $url ){
  79      return home_url();
  80  }
  81  
  82  /**
  83   *  Fix The WordPress Login Image Title
  84   */
  85  add_filter('login_headertitle', 'fix_wp_login_imagetitle');
  86  
  87  /**
  88   *
  89   * @TODO document
  90   *
  91   */
  92  function fix_wp_login_imagetitle( $url ){
  93      return get_bloginfo('name');
  94  }
  95  
  96  /**
  97   *
  98   * @TODO document
  99   *
 100   */
 101  function pl_fix_login_image( ){
 102  
 103      $image_url = (ploption('pl_login_image')) ? ploption('pl_login_image') : PL_ADMIN_IMAGES . '/login-pl.png';
 104  
 105      $css = sprintf('body #login h1 a{background: url(%s) no-repeat top center;height: 80px;background-size:auto; background-size: auto 80px;}', $image_url);
 106  
 107      inline_css_markup('pagelines-login-css', $css);
 108  }
 109  
 110  /**
 111   *  Fix The WordPress Favicon by Site Title
 112   */
 113  add_action('admin_head', 'pl_fix_admin_favicon');
 114  
 115  /**
 116   *
 117   * @TODO document
 118   *
 119   */
 120  function pl_fix_admin_favicon( ){
 121  
 122      $image_url = (ploption('pagelines_favicon')) ? ploption('pagelines_favicon') : PL_ADMIN_IMAGES . '/favicon-pagelines.png';
 123  
 124      $css = sprintf('#wphead #header-logo{background: url(%s) no-repeat scroll center center;}', $image_url);
 125  
 126      inline_css_markup('pagelines-wphead-img', $css);
 127  }


Generated: Fri Aug 30 18:26:24 2013 Cross-referenced by PHPXref 0.7.1