Skip to content

Commit

Permalink
1.2.0
Browse files Browse the repository at this point in the history
Modify markup of thumbnails and modify CSS.
  • Loading branch information
takashi-matsuyama committed Apr 24, 2021
1 parent 35411e0 commit 8e8fb3b
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion addons/ccc-post_thumbnail/ccc-post_thumbnail.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class CCC_Post_Thumbnail {
/*** 投稿本文の中から1枚目の画像のURLを取得 ***/
public static function get_first_image_url( $post=null ) {
$first_img = rtrim( plugin_dir_url( __FILE__ ), '/').'/no-image.svg'; // 投稿内で画像がなかったときのためのデフォルト画像を指定
$first_img = rtrim( plugin_dir_url( __FILE__ ), '/').'/no-image.jpg'; // 投稿内で画像がなかったときのためのデフォルト画像を指定
if( empty($post) ) {
global $post;
} // endif
Expand Down
Binary file added addons/ccc-post_thumbnail/no-image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion addons/ccc-post_thumbnail/no-image.svg

This file was deleted.

15 changes: 15 additions & 0 deletions assets/list.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@
margin: 0 1% 1% 0;
position: relative;
}
#ccc-browsing_history-list[data-ccc_browsing_history-list-style="1"] #post-ccc_browsing_history .img-post .img-post-thumbnail {
width: 100%;
padding-bottom: 56.25%; /* 16:9 */
position: relative;
}
#ccc-browsing_history-list[data-ccc_browsing_history-list-style="1"] #post-ccc_browsing_history .img-post .img-post-thumbnail img {
object-fit: cover;
width: 100%;
max-width: 100%;
height: 100%;
max-height: 100%;
position: absolute;
top: 0;
left: 0;
}
#ccc-browsing_history-list[data-ccc_browsing_history-list-style="1"] #post-ccc_browsing_history .title-post {
font-size: 0.9em;
font-weight: 500;
Expand Down
2 changes: 1 addition & 1 deletion assets/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Author: Takashi Matsuyama
* Author URI: https://profiles.wordpress.org/takashimatsuyama/
* Description: WordPressで投稿の閲覧履歴を一覧で表示
* Version: 1.0.0
* Version: 1.0.0 or later
*/

/*
Expand Down
4 changes: 2 additions & 2 deletions assets/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public static function action() {
<a href="<?php the_permalink(); ?>">
<?php
if( has_post_thumbnail() ) {
echo '<div class="img-post-thumbnail" style="background-image: url('.get_the_post_thumbnail_url($the_query->post->ID, 'medium').');"></div>';
echo '<div class="img-post-thumbnail has_post_thumbnail"><img src="'.get_the_post_thumbnail_url($the_query->post->ID, 'medium').'" alt="'.$the_query->post->post_title.'" loading="lazy" /></div>';
} else {
echo '<div class="img-post-thumbnail" style="background-image: url('.CCC_Post_Thumbnail::get_first_image_url($the_query->post).');"></div>';
echo '<div class="img-post-thumbnail has_post_thumbnail-no"><img src="'.CCC_Post_Thumbnail::get_first_image_url($the_query->post).'" alt="'.$the_query->post->post_title.'" loading="lazy" /></div>';
}
?>
</a>
Expand Down
2 changes: 1 addition & 1 deletion assets/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Author: Takashi Matsuyama
* Author URI: https://profiles.wordpress.org/takashimatsuyama/
* Description: WordPressで投稿の閲覧履歴をローカルストレージとMySQLのユーザーメタ(wp_usermeta)に保存
* Version: 1.0.0
* Version: 1.0.0 or later
*/

/* グローバルネームスペース */
Expand Down
4 changes: 2 additions & 2 deletions browsing-history.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Browsing History
* Plugin URI: https://wordpress.org/plugins/browsing-history
* Description: Save user’s browsing history and list them.
* Version: 1.1.0
* Version: 1.2.0
* Requires at least: 4.8
* Requires PHP: 5.4.0
* Author: Takashi Matsuyama
Expand Down Expand Up @@ -53,7 +53,7 @@ function ccc_browsing_history_initialize() {

/*** How to use this Shortcode ***/
/*
* [ccc_browsing_history_list_results title="string" posts_per_page="int" class="string" style=""]
* [ccc_browsing_history_list_results title="string" posts_per_page="int" class="string" style="string"]
*/
require( CCCBROWSINGHISTORY_PLUGIN_PATH .'/assets/shortcode-list.php' );

Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: browsing history, accessibility, design
Requires at least: 4.8
Tested up to: 5.6
Requires PHP: 5.4.0
Stable tag: 1.1.0
Stable tag: 1.2.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -33,6 +33,9 @@ The logged-in user's data is saved in the user meta. Other user's data is saved

== Changelog ==

= 1.2.0 =
Modify markup of thumbnails and modify CSS.

= 1.1.0 =
Add shortcode attribute (`style=""`) and modify CSS.

Expand Down

0 comments on commit 8e8fb3b

Please sign in to comment.