WordPress Popular Postsで、{text_title}に文字数制限’title_length’を効かせる
リスト全体をaタグで囲ってスタイリングしていたので、タイトルにつくaタグは不要、でも{text_title}は文字数制限が効かない。
ということで。
プラグイン編集>wordpress-popular-posts>includes>class-wordpress-popular-posts-output.phpを選択。
wordpress-popular-posts/includes/class-wordpress-popular-posts-output.php
195行目あたりからの下記の記述中、
// Build custom HTML output if ( $this->options['markup']['custom_html'] ) { $data = array( 'id' => $post_object->id, 'title' => '<a class="wpp-post-title" title="' . $post_title_attr . '" href="' . $permalink . '" target="' . $this->admin_options['tools']['link']['target'] . '">' . $post_title . '</a>', 'summary' => $post_excerpt, 'stats' => $post_meta, 'img' => ( !empty( $post_thumbnail ) ) ? '<a title="' . $post_title_attr . '" href="' . $permalink . '" target="' . $this->admin_options['tools']['link']['target'] . '">' . $post_thumbnail . '</a>' : '', 'img_no_link' => $post_thumbnail, 'url' => $permalink, //'text_title' => $post_title_attr, ←これをコメントアウトまたは削除 'text_title' => $post_title, ←これを追加 'taxonomy' => $post_taxonomies, 'author' => ( !empty($post_author) ) ? '<a href="' . get_author_posts_url( $post_object->uid ) . '">' . $post_author . '</a>' : '', 'views' => ( $this->options['order_by'] == "views" || $this->options['order_by'] == "comments" ) ? number_format_i18n( $post_views ) : number_format_i18n( $post_views, 2 ), 'comments' => number_format_i18n( $post_comments ), 'date' => $post_date ); $post = $this->format_content( htmlspecialchars_decode( $this->options['markup']['post-html'], ENT_QUOTES ), $data, $this->options['rating'] ). "\n"; } // Use the "stock" HTML output
この中で、
'text_title' => $post_title_attr,
となっているのを
'text_title' => $post_title,
と修正。
コメントをどうぞ!