Ver Mensaje Individual
  #6 (permalink)  
Antiguo 16/12/2013, 10:50
Avatar de rodrypaladin
rodrypaladin
Moderador
 
Fecha de Ingreso: abril-2010
Ubicación: Madrid
Mensajes: 2.127
Antigüedad: 14 años, 8 meses
Puntos: 468
Respuesta: Mostrar siempre el título de los posts completos

Encontré este archivo donde si que he encontrado esos caracteres.

Código PHP:
Ver original
  1. <?php
  2. /**
  3.  * MyArcadePlugin Theme API  - Helps theme developers to create MyArcadePlugin compatible themes.
  4.  *
  5.  * @package MyArcadePlugin Theme API
  6.  * @author Daniel Bakovic - http://myarcadeplugin.com
  7.  *
  8.  * @version 1.0.0
  9.  */
  10.  
  11.  
  12. if ( !function_exists('myarcade_title')) {
  13.   /**
  14.   * Display or retrieve the title of the current post/game. The title can be cutted after x characters.
  15.   * Words will not be cutted off (wordwrap).
  16.   *
  17.   * @usage Use this function only in the WordPress post loop
  18.   *
  19.   * @since 1.0
  20.   *
  21.   * @param int $chars Optional. Max. length of the title
  22.   * @param bool $echo Optional. default to true. Whether to display or return.
  23.   * @return string $title String if $echo parameter is false.
  24.   */
  25.   function myarcade_title ($chars = 0, $echo = true) {
  26.  
  27.     $title = strip_tags( the_title('', '', FALSE) );
  28.  
  29.     if ( $chars > 0 ) {
  30.       if ( (strlen($title) > $chars) ) {
  31.         $title = mb_substr($title, 0, $chars);
  32.         $title = mb_substr($title, 0, -strlen(strrchr($title, ' ')));  // Wordwrap
  33.  
  34.         if ( strlen($title) < 4 ) {
  35.           $title = mb_substr( the_title('', '',FALSE), 0, $chars );
  36.         }
  37.  
  38.         $title .= ' ..';
  39.       }
  40.     }
  41.  
  42.     if ($echo == true) { echo $title; } else { return $title; }
  43.   }
  44. }
  45.  
  46.  
  47. if ( !function_exists('myarcade_excerpt')) {
  48.   /**
  49.   * Display or retrieve the excerpt of a game post. All tags will be removed.
  50.   *
  51.   * @usage Use this function only in the WordPress post loop
  52.   *
  53.   * @since 1.0
  54.   *
  55.   * @param int $length Character length of the excerpt
  56.   * @param bool $echo Optional. Return or echo the result
  57.   */
  58.   function myarcade_excerpt($length = false, $echo = true) {
  59.     global $post;
  60.  
  61.     // Get post excerpt
  62.     $text = strip_shortcodes( $post->post_content );
  63.     $text = apply_filters('the_content', $text);
  64.     $text = str_replace(']]>', ']]&gt;', $text);
  65.     $text = wp_trim_words( $text, 100, '' );  
  66.  
  67.     if ( $length ) {
  68.       if ( strlen($text) > $length ) {
  69.         $text = mb_substr($text, 0, $length).' [...]';
  70.       }
  71.     }
  72.  
  73.     if ($echo) { echo $text; } else { return $text; }
  74.   }
  75. }
  76.  
  77.  
  78. if ( !function_exists('myarcade_thumbnail')) {
  79.   /**
  80.   * Display the game thumbnail of the current game.
  81.   * If no thumbnail is available the function will display a default thumbnail located in the template directory.
  82.   *
  83.   * default thumb: /template_directory/images/def_thumb.png
  84.   *
  85.   * @usage Use this function only in the WordPress post loop
  86.   *
  87.   * @since 1.0
  88.   *
  89.   * @param int $width Optional. Width of the thumbnail in px. Default: 100
  90.   * @param int $height Optional. Height of the thumbnail in px. Default: 100
  91.   * @param string $class Optional. CSS class for the image tag
  92.   */
  93.   function myarcade_thumbnail ($width = 100, $height = 100, $class = '') {
  94.     global $post;
  95.  
  96.     if ( !empty($class) ) { $class = 'class="'.$class.'"'; }
  97.  
  98.     $thumbnail = get_post_meta($post->ID, "mabp_thumbnail_url", true);
  99.  
  100.     if ( preg_match('|^(http).*|i', $thumbnail) == 0 ) {
  101.       // No Thumbail available.. get the default thumb
  102.      
  103.       $thumbnail = get_template_directory_uri().'/images/def_thumb.png';
  104.      
  105.       if ( !file_exists($thumbnail) ) {
  106.         $thumbnail = MYARCADE_URL .'/templates/assets/images/def_thumb.png';
  107.       }
  108.     }
  109.  
  110.     $args = array( 'before' => '', 'after' => '', 'echo' => false );
  111.  
  112.     echo '<img src="'.$thumbnail.'" width="'.$width.'" height="'.$height.'" '.$class.' alt="'.the_title_attribute( $args ).'" />';
  113.   }
  114. }
  115.  
  116.  
  117. if ( !function_exists('myarcade_get_thumbnail_url')) {
  118.   /**
  119.   * Get the url of the current game thumbnail
  120.   *
  121.   * @usage Use this function only in the WordPress post loop
  122.   *
  123.   * @since 1.0
  124.   */
  125.   function myarcade_get_thumbnail_url() {
  126.     global $post;  
  127.     return get_post_meta($post->ID, "mabp_thumbnail_url", true);
  128.   }
  129. }
  130.  
  131.  
  132. if ( !function_exists('myarcade_count_screenshots')) {
  133.   /**
  134.   * Get the number of available screenshots for the current game.
  135.   *
  136.   * @usage Use this function only in the WordPress post loop
  137.   *
  138.   * @since 1.0
  139.   *
  140.   * @return int Number of screenshots
  141.   */
  142.   function myarcade_count_screenshots () {
  143.     global $post;
  144.  
  145.     $screen_count = 0;
  146.  
  147.     for ($screen_nr = 1; $screen_nr <= 4; $screen_nr++) {  
  148.       if ( preg_match('|^(http).*|i', get_post_meta($post->ID, "mabp_screen".$screen_nr."_url", true)) ) {
  149.         $screen_count++;
  150.       }
  151.     }
  152.  
  153.     return intval($screen_count);
  154.   }
  155. }
  156.  
  157.  
  158. if ( !function_exists('myarcade_screenshot')) {
  159.   /**
  160.   * Display the given screenshot of the current game.
  161.   *
  162.   * @usage Use this function only in the WordPress post loop
  163.   *
  164.   * @since 1.0
  165.   *
  166.   * @param int $width Optional. Width of the screen shot in px. Default: 450
  167.   * @param int $height Optional. Height of the screen shot in px. Default: 350
  168.   * @param int $number Optional. The number of the screenshot (1..4). Default 1
  169.   * @param string $class Optional. CSS class fot the image tag
  170.   */
  171.   function myarcade_screenshot ($width = 450, $height = 300, $number = 1, $class = '') {
  172.     global $post;
  173.  
  174.     if ( !empty($class) ) { $class = 'class="'.$class.'"'; }
  175.  
  176.     $screenshot = get_post_meta($post->ID, "mabp_screen".$number."_url", true);
  177.  
  178.     if ( preg_match('|^(http).*|i', $screenshot) ) {
  179.       $args = array( 'before' => '', 'after' => '', 'echo' => false );
  180.       echo '<img src="'.$screenshot.'"  width="'.$width.'" height="'.$height.'" '.$class.' alt="'.the_title_attribute( $args ).'" />';
  181.     }
  182.   }
  183. }
  184.  
  185.  
  186. if ( !function_exists('myarcade_get_screenshot_url')) {
  187.   /**
  188.   * Retrieves the screenshot url for the current game
  189.   *
  190.   * @usage Use this function only in the WordPress post loop
  191.   *
  192.   * @since 1.0
  193.   *
  194.   * @param int $number Optional. The number of the screenshot (1..4). Default 1
  195.   * @param bool $echo Optional. Return or echo the result
  196.   */
  197.   function myarcade_get_screenshot_url ($number = 1, $echo = true) {
  198.     global $post;
  199.  
  200.     $screenshot = get_post_meta($post->ID, "mabp_screen".$number."_url", true);
  201.  
  202.     if ( $echo == true ) { echo $screenshot; } else { return $screenshot; }
  203.   }
  204. }
  205.  
  206.  
  207. if ( !function_exists('myarcade_all_screenshots')) {
  208.   /**
  209.   * Display all available screenshots of the current game.
  210.   *
  211.   * @usage Use this function only in the WordPress post loop
  212.   *
  213.   * @since 1.0
  214.   *
  215.   * @param int $width Optional. Width of the screen shot in px. Default: 450
  216.   * @param int $height Optional. Height of the screen shot in px. Default: 350
  217.   * @param int $screen_nr Optional. The number of the screen (1..4). Default 1
  218.   * @param string $class Optional. CSS class fot the image tag
  219.   */
  220.   function myarcade_all_screenshots ($width = 450, $height = 300, $class = '') {
  221.     global $post;
  222.  
  223.     $args = array( 'before' => '', 'after' => '', 'echo' => false );
  224.  
  225.     if ( !empty($class) ) { $class = 'class="'.$class.'"'; }  
  226.  
  227.     for ($screen_nr = 1; $screen_nr <= 4; $screen_nr++) {
  228.       $screenshot = get_post_meta($post->ID, "mabp_screen".$screen_nr."_url", true);
  229.  
  230.       if ( preg_match('|^(http).*|i', $screenshot) ) {      
  231.         echo '<a href="'.$screenshot.'" title="'.the_title_attribute( $args ).'" rel="prettyPhoto[slides]"><img src="'.$screenshot.'"  width="'.$width.'" height="'.$height.'" '.$class.' alt="'.the_title_attribute( $args ).'" /></a>';
  232.       }
  233.     }
  234.   }
  235. }
  236.  
  237. if ( !function_exists( 'is_myarcade_game') ) {
  238.   /**
  239.    * Checks is the current post is a MyArcadePlugin game
  240.    *
  241.    * @return boolean
  242.    */
  243.   function is_myarcade_game() {    
  244.     if ( defined('MYARCADE_VERSION') && function_exists( 'is_game') ) {
  245.       return is_game();
  246.     }
  247.     return false;
  248.   }
  249. }
  250.  
  251. if ( !function_exists( 'myarcade_featured_image' ) ) {
  252.   /**
  253.    * Return a featured image url.
  254.    * Function added for the Gameleon theme
  255.    *
  256.    * @return string image url
  257.    */
  258.   function myarcade_featured_image() {  
  259.     $image = myarcade_get_screenshot_url(1, false);    
  260.     if ( !$image ) {
  261.       $image = myarcade_get_thumbnail_url();
  262.     }    
  263.     return $image;
  264.   }
  265. }
  266. ?>
__________________
No te olvides de dar +1 a quien te echa un cable ;)

Última edición por rodrypaladin; 16/12/2013 a las 11:04