WordPress Cocoon

【Cocoon】プロフィールボックスをJIN風にカスタマイズ

当サイトはアフィリエイト広告を利用しています。

WordPressテーマ「Cocoon」のカスタマイズ備忘録です。以前にプロフィールボックスの「SANGO」風カスタマイズの記事を書きましたが、今回は「JIN」風のカスタマイズをやってみたいと思います。

サイドバーではこんな感じ↓

記事下メインカラムでの表示↓

記事下メインカラムのスマホ表示↓

「JIN」と全く同じではなくて少しアレンジも加えています。CSSのコードは以下の3つに分けて紹介します。

  • サイドバーのみに表示する場合
  • 記事下のみに表示する場合
  • サイドバーと記事下の両方に表示する場合

それではいってみましょう〜!

プロフィール欄を表示するための準備

カスタマイズの前にプロフィール情報を設定しておいてください。まだ設定していない場合はSANGO編の記事で手順を紹介しているので参考にどうぞ↓

functions.phpの編集

「JIN」風にカスタマイズするためには、プロフィールボックスを表示しているテンプレートを修正する必要があります。

Cocoonの親テーマの「lib」フォルダ内にある「html-forms.php」というファイルにプロフィールボックスを表示させるためのコードがありますが、そのコードを子テーマで修正するには「functions.php」で上書きします

functions.phpは少しでもコードが間違っているとサイトが真っ白になります。編集は慎重にやりましょう。

以下のコードをそのまま子テーマの「functions.php」にコピペしてください↓

  • PHP
  1. //プロフィールボックス生成関数
  2. if ( !function_exists( 'generate_author_box_tag' ) ):
  3. function generate_author_box_tag($id = null, $label = null, $is_image_circle = 0){
  4. $user_id = get_the_author_meta( 'ID' );
  5. if (!$user_id || is_404()) {
  6. $user_id = get_sns_default_follow_user();
  7. }
  8. if ($id && get_userdata( $id )) {
  9. $user_id = $id;
  10. }
  11. ?>
  12. <div class="author-box border-element no-icon cf">
  13. <?php //ウィジェット名がある場合
  14. $image_class = $is_image_circle ? ' circle-image' : null; ?>
  15. <figure class="author-thumb<?php echo $image_class; ?>">
  16. <?php echo get_avatar( $user_id, 200 ); ?>
  17. </figure>
  18. <div class="author-name">
  19. <?php
  20. if ($user_id) {
  21. $description = get_the_author_description_text($user_id);
  22. //$description = trim(get_the_author_description_text());
  23. if (empty($description)) {
  24. $description = get_the_author_meta('description', $user_id);
  25. }
  26. $description = wpautop($description);
  27. if (!is_buddypress_page()) {
  28. //プロフィールページURLの取得
  29. $profile_page_url = get_the_author_profile_page_url($user_id);
  30. $author_display_name = strip_tags(get_the_author_display_name($user_id));
  31. if ($profile_page_url) {
  32. $name = '<a href="'.$profile_page_url.'">'.$author_display_name.'</a>';
  33. //$name = get_nofollow_link($profile_page_url, $author_display_name);
  34. //echo $name;
  35. } else {
  36. //$name = get_the_author_posts_link($user_id);
  37. $user = get_userdata( $user_id );
  38. $name = sprintf( '<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
  39. esc_url( get_author_posts_url( $user->ID, $user->user_nicename ) ),
  40. /* translators: %s: author's display name */
  41. esc_attr( sprintf( __( 'Posts by %s' ), $user->display_name ) ),
  42. $user->display_name
  43. );
  44. //_v($user);
  45. }
  46. } else {
  47. $author_display_name = strip_tags(get_the_author_display_name($user_id));
  48. $author_website_url = strip_tags(get_the_author_website_url($user_id));
  49. $description = strip_tags($description);
  50. $name = $author_display_name;
  51. if ($author_website_url) {
  52. $name = '<a href="'.$author_website_url.'" target="_blank" rel="nofollow">'.$author_display_name.'</a>';
  53. }
  54. //echo $name;
  55. }
  56. echo apply_filters( 'the_author_box_name', $name );
  57. } else {
  58. echo __( '未登録のユーザーさん', THEME_NAME );
  59. }
  60. ?>
  61. </div>
  62. <?php if ($label): ?>
  63. <div class="author-widget-name">
  64. <?php echo $label; ?>
  65. </div>
  66. <?php endif ?>
  67. <div class="author-content">
  68. <div class="author-description">
  69. <?php
  70. if ($description) {
  71. echo $description;
  72. } elseif (!$user_id) {
  73. if (is_buddypress_exist()) {
  74. echo __( '未登録のユーザーさんです。', THEME_NAME );
  75. echo '<br>';
  76. echo __( 'ログイン・登録はこちら→', THEME_NAME );
  77. echo '<a href="'.wp_login_url().'">';
  78. echo __( 'ログインページ', THEME_NAME );
  79. echo '</a>';
  80. }
  81. } elseif (is_user_logged_in()) {
  82. echo __( 'プロフィール内容は管理画面から変更可能です→', THEME_NAME ).'<a href="/wp-admin/user-edit.php?user_id='.get_the_author_meta( 'ID' ).'">'.__( 'プロフィール設定画面', THEME_NAME ).'</a><br>'.__( '※このメッセージは、ログインユーザーにしか表示されません。', THEME_NAME );
  83. }
  84. ?>
  85. </div>
  86. <?php if ($user_id): ?>
  87. <div class="author-follows">
  88. <?php
  89. set_query_var( '_USER_ID', $user_id );
  90. get_template_part('tmp/sns-follow-buttons');
  91. set_query_var( '_USER_ID', null ); ?>
  92. </div>
  93. <?php endif ?>
  94. </div>
  95. </div>
  96. <?php
  97. }
  98. endif;
//プロフィールボックス生成関数
if ( !function_exists( 'generate_author_box_tag' ) ):
function generate_author_box_tag($id = null, $label = null, $is_image_circle = 0){
  $user_id = get_the_author_meta( 'ID' );
  if (!$user_id || is_404()) {
    $user_id = get_sns_default_follow_user();
  }
  if ($id && get_userdata( $id )) {
    $user_id = $id;
  }

  ?>
  <div class="author-box border-element no-icon cf">
    <?php //ウィジェット名がある場合
    $image_class = $is_image_circle ? ' circle-image' : null; ?>
    <figure class="author-thumb<?php echo $image_class; ?>">
      <?php echo get_avatar( $user_id, 200 ); ?>
    </figure>
      <div class="author-name">
        <?php
        if ($user_id) {
          $description = get_the_author_description_text($user_id);
          //$description = trim(get_the_author_description_text());
          if (empty($description)) {
            $description = get_the_author_meta('description', $user_id);
          }
          $description = wpautop($description);

          if (!is_buddypress_page()) {
            //プロフィールページURLの取得
            $profile_page_url = get_the_author_profile_page_url($user_id);

            $author_display_name = strip_tags(get_the_author_display_name($user_id));
            if ($profile_page_url) {
              $name = '<a href="'.$profile_page_url.'">'.$author_display_name.'</a>';
              //$name = get_nofollow_link($profile_page_url, $author_display_name);
              //echo $name;
            } else {
              //$name = get_the_author_posts_link($user_id);
              $user = get_userdata( $user_id );
              $name = sprintf( '<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
                esc_url( get_author_posts_url( $user->ID, $user->user_nicename ) ),
                /* translators: %s: author's display name */
                esc_attr( sprintf( __( 'Posts by %s' ), $user->display_name ) ),
                $user->display_name
              );
              //_v($user);
            }
          } else {
            $author_display_name = strip_tags(get_the_author_display_name($user_id));
            $author_website_url = strip_tags(get_the_author_website_url($user_id));
            $description = strip_tags($description);
            $name = $author_display_name;
            if ($author_website_url) {
              $name = '<a href="'.$author_website_url.'" target="_blank" rel="nofollow">'.$author_display_name.'</a>';
            }
            //echo $name;
          }
          echo apply_filters( 'the_author_box_name', $name );


        } else {
          echo __( '未登録のユーザーさん', THEME_NAME );
        }
         ?>
      </div>
    <?php if ($label): ?>
      <div class="author-widget-name">
        <?php echo $label; ?>
      </div>
     <?php endif ?>
    <div class="author-content">
      <div class="author-description">
        <?php
        if ($description) {
          echo $description;
        } elseif (!$user_id) {
          if (is_buddypress_exist()) {
            echo __( '未登録のユーザーさんです。', THEME_NAME );
            echo '<br>';
            echo __( 'ログイン・登録はこちら→', THEME_NAME );
            echo '<a href="'.wp_login_url().'">';
            echo __( 'ログインページ', THEME_NAME );
            echo '</a>';
          }

        } elseif (is_user_logged_in()) {
          echo __( 'プロフィール内容は管理画面から変更可能です→', THEME_NAME ).'<a href="/wp-admin/user-edit.php?user_id='.get_the_author_meta( 'ID' ).'">'.__( 'プロフィール設定画面', THEME_NAME ).'</a><br>'.__( '※このメッセージは、ログインユーザーにしか表示されません。', THEME_NAME );
        }
        ?>

      </div>

      <?php if ($user_id): ?>
      <div class="author-follows">
        <?php
        set_query_var( '_USER_ID', $user_id );
        get_template_part('tmp/sns-follow-buttons');
        set_query_var( '_USER_ID', null ); ?>
      </div>
      <?php endif ?>
    </div>    
  </div>
<?php
}
endif;

少し長いですがコピペするだけなので、ちゃんと1文字残らず選択できているかだけ気を付けてください。

サイドバーだけにプロフィールボックスを表示する場合

サイドバーだけに表示する時は、以下のコードをCSSに追加してください↓

  • CSS
  1. .author-box .author-name { /*ニックネームのスタイル指定*/
  2. font-size: 1em;
  3. font-weight: normal;
  4. margin-bottom: 0;
  5. }
  6. .author-name a {
  7. text-decoration: none;
  8. color: #333; /*ニックネームの文字色*/
  9. }
  10. .author-widget-name { /*肩書きのスタイル指定*/
  11. font-size: 0.8em;
  12. color: #bbb;
  13. }
  14. .author-box p { /*プロフィール文のスタイル指定*/
  15. margin-top: 2em;
  16. line-height: 1.5;
  17. font-size: 0.9em;
  18. }
  19. .author-box { /*全体を囲むボックスのスタイル指定*/
  20. border: 1px solid #eee;
  21. border-radius: 4px;
  22. margin: 1em 0;
  23. line-height: 1.4;
  24. position: relative;
  25. padding: 1.4% 2% 1.8%;
  26. }
  27. .author-follows { /*フォローボタンボックスのスタイル指定*/
  28. background: #72c7e6; /*フォローボタンボックスの背景色*/
  29. margin: 0 -20px -20px -20px;
  30. padding: 20px 0;
  31. }
  32. .author-box .sns-follow-message { /*フォローボタン上部メッセージのスタイル指定*/
  33. display: block;
  34. color: #fff;
  35. }
  36. .author-box .sns-follow-buttons a.follow-button { /*ボタンのスタイル指定*/
  37. font-size: 18px;
  38. width: 36px;
  39. height: 36px;
  40. border-radius: 50%;
  41. margin-bottom: 4px;
  42. margin-right: 4px;
  43. background: none; /*フォローボタン背景*/
  44. color: #fff; /*アイコンの色*/
  45. border: 1px solid #fff; /*ボーダーの指定*/
  46. transition: .5s;
  47. }
  48. .author-box .sns-follow-buttons a.follow-button:hover {
  49. background: #2ea5d0; /*フォローボタンのマウスホバー時の背景色*/
  50. opacity: 1;
  51. }
  52. .author-box a.follow-button span {
  53. line-height: 32px;
  54. }
  55. .author-box .icon-twitter-logo::before {
  56. font-family: FontAwesome;
  57. content: "\f099"
  58. }
  59. .author-box .icon-facebook-logo::before {
  60. font-family: FontAwesome;
  61. content: "\f09a";
  62. }
  63. .author-box .icon-instagram-new::before {
  64. font-family: FontAwesome;
  65. content: "\f16d";
  66. }
  67. .author-box .icon-hatebu-logo::before {
  68. font-family: Verdana;
  69. content: 'B!';
  70. font-weight: bold;
  71. }
  72. .author-box .icon-google-plus-logo::before {
  73. font-family: FontAwesome;
  74. content: "\f0d5";
  75. }
  76. .author-box .icon-youtube-logo::before {
  77. font-family: FontAwesome;
  78. content: "\f167";
  79. }
  80. .author-box .icon-pinterest-logo::before {
  81. font-family: FontAwesome;
  82. content: "\f231";
  83. }
  84. .author-box .icon-amazon-logo::before {
  85. font-family: FontAwesome;
  86. content: "\f270";
  87. }
  88. .author-box .icon-github-logo::before {
  89. font-family: FontAwesome;
  90. content: "\f09b";
  91. }
.author-box .author-name { /*ニックネームのスタイル指定*/
  font-size: 1em;
  font-weight: normal;
  margin-bottom: 0;
}
.author-name a {
  text-decoration: none;
  color: #333; /*ニックネームの文字色*/
}
.author-widget-name { /*肩書きのスタイル指定*/
  font-size: 0.8em;
  color: #bbb;
}
.author-box p { /*プロフィール文のスタイル指定*/
  margin-top: 2em;
  line-height: 1.5;
  font-size: 0.9em;
}
.author-box { /*全体を囲むボックスのスタイル指定*/
  border: 1px solid #eee;
  border-radius: 4px;
  margin: 1em 0;
  line-height: 1.4;
  position: relative;
  padding: 1.4% 2% 1.8%;
}
.author-follows { /*フォローボタンボックスのスタイル指定*/
  background: #72c7e6; /*フォローボタンボックスの背景色*/
  margin: 0 -20px -20px -20px; 
  padding: 20px 0;
}
.author-box .sns-follow-message { /*フォローボタン上部メッセージのスタイル指定*/
  display: block;
  color: #fff;
}
.author-box .sns-follow-buttons a.follow-button { /*ボタンのスタイル指定*/
  font-size: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  margin-bottom: 4px;
  margin-right: 4px;
  background: none; /*フォローボタン背景*/
  color: #fff; /*アイコンの色*/
  border: 1px solid #fff; /*ボーダーの指定*/
  transition: .5s;
}
.author-box .sns-follow-buttons a.follow-button:hover {
  background: #2ea5d0; /*フォローボタンのマウスホバー時の背景色*/
  opacity: 1;
}
.author-box a.follow-button span {
  line-height: 32px;
}
.author-box .icon-twitter-logo::before {
  font-family: FontAwesome;
  content: "\f099"
}
.author-box .icon-facebook-logo::before {
  font-family: FontAwesome;
  content: "\f09a";
}
.author-box .icon-instagram-new::before {
  font-family: FontAwesome;
  content: "\f16d";
}
.author-box .icon-hatebu-logo::before {
  font-family: Verdana;
  content: 'B!';
  font-weight: bold;
}
.author-box .icon-google-plus-logo::before {
  font-family: FontAwesome;
  content: "\f0d5";
}
.author-box .icon-youtube-logo::before {
  font-family: FontAwesome;
  content: "\f167";
}
.author-box .icon-pinterest-logo::before {
  font-family: FontAwesome;
  content: "\f231";
}
.author-box .icon-amazon-logo::before {
  font-family: FontAwesome;
  content: "\f270";
}
.author-box .icon-github-logo::before {
  font-family: FontAwesome;
  content: "\f09b";
}

各部のカラーなどはコード内に記載したコメントを参考にお好みで変更してください。

「SANGO」風の時と同様に、アイコンはCocoonのデフォルトだと大きさにバラつきがあるので「Font Awesome」で代用できるものは変更しています。

プロフィールのウィジェットの設定

CSSを追加したらウィジェットを設定すればプロフィールが表示されます。

管理画面のメニューから「ウィジェット」のページを開いて「サイドバー」に「[c]プロフィール」を追加します↓

タイトルは未入力のままで、「肩書きラベル」だけ入力します。あと「画像を円形にする」のチェックを入れて「保存」ボタンを押せば完了です。

 

サイドバーを確認してみると、こんな感じで表示されていると思います。

 

FeedlyとRSSボタンを非表示にしたい場合

FeedlyとRSSのボタンはプロフィール設定に関係なく表示されるので、消したい場合は下記のCSSを追記すればオッケーです。

  • CSS
  1. .author-box .feedly-button, .author-box .rss-button {
  2. display: none!important;
  3. }
.author-box .feedly-button, .author-box .rss-button {
  display: none!important;
}

記事下だけにプロフィールボックスを表示する場合

次は記事下のメインカラムだけに表示する場合です。以下のコードをCSSにコピペしてください↓

  • CSS
  1. .author-box .author-name { /*ニックネームのスタイル指定*/
  2. font-size: 1em;
  3. font-weight: normal;
  4. margin-bottom: 0;
  5. }
  6. .author-name a {
  7. text-decoration: none;
  8. color: #333; /*ニックネームの文字色*/
  9. }
  10. .author-widget-name { /*肩書きのスタイル指定*/
  11. font-size: 0.8em;
  12. color: #bbb;
  13. }
  14. .author-box p { /*プロフィール文のスタイル指定*/
  15. margin-top: 1em;
  16. line-height: 1.5;
  17. font-size: 0.9em;
  18. }
  19. .author-box { /*全体を囲むボックスのスタイル指定*/
  20. border: none;
  21. border-top: 1px solid #72c7e6;
  22. margin: 1em 0;
  23. padding: 30px 2% 1.8%;
  24. line-height: 1.4;
  25. position: relative;
  26. }
  27. .author-box::after { /*全体を囲むボックス上部の見出し設定*/
  28. content: "ABOUT ME";
  29. font-size: 14px;
  30. background: #72c7e6;
  31. border-radius: 0 0 10px 10px;
  32. color: #fff;
  33. padding: 6px 20px;
  34. position: absolute;
  35. top: 0;
  36. right: 0;
  37. }
  38. .author-follows {
  39. background: none;
  40. margin: 0;
  41. padding: 0;
  42. }
  43. .author-box .sns-follow-message {
  44. display: none;
  45. }
  46. .author-box .sns-follow-buttons a.follow-button { /*フォローボタンのスタイル指定*/
  47. font-size: 18px;
  48. width: 36px;
  49. height: 36px;
  50. border-radius: 50%;
  51. margin-bottom: 4px;
  52. margin-right: 4px;
  53. background: #72c7e6; /*フォローボタン背景*/
  54. color: #fff; /*アイコンの色*/
  55. border: none; /*ボーダーの指定*/
  56. transition: .5s;
  57. }
  58. .author-box .sns-follow-buttons a.follow-button:hover {
  59. background: #2ea5d0; /*フォローボタンのマウスホバー時の背景色*/
  60. opacity: 1;
  61. }
  62. .author-box a.follow-button span {
  63. line-height: 32px;
  64. }
  65. @media screen and (max-width: 480px){
  66. .author-box {
  67. text-align: center;
  68. font-size: 0.9em;
  69. }
  70. .author-box::after {
  71. right: auto;
  72. left: 0;
  73. }
  74. .author-thumb {
  75. float: none;
  76. margin-top: 3px;
  77. width: 120px;
  78. display: inline-block;
  79. }
  80. .author-box .author-thumb {
  81. float: none;
  82. margin-top: 3px;
  83. width: 120px;
  84. }
  85. .author-box .author-thumb img {
  86. margin: 0 auto;
  87. }
  88. .author-box .author-content {
  89. margin: 0;
  90. }
  91. .author-description {
  92. text-align: left;
  93. }
  94. .author-box .sns-follow-buttons {
  95. justify-content: center;
  96. }
  97. }
  98. .author-box .icon-twitter-logo::before {
  99. font-family: FontAwesome;
  100. content: "\f099"
  101. }
  102. .author-box .icon-facebook-logo::before {
  103. font-family: FontAwesome;
  104. content: "\f09a";
  105. }
  106. .author-box .icon-instagram-new::before {
  107. font-family: FontAwesome;
  108. content: "\f16d";
  109. }
  110. .author-box .icon-hatebu-logo::before {
  111. font-family: Verdana;
  112. content: 'B!';
  113. font-weight: bold;
  114. }
  115. .author-box .icon-google-plus-logo::before {
  116. font-family: FontAwesome;
  117. content: "\f0d5";
  118. }
  119. .author-box .icon-youtube-logo::before {
  120. font-family: FontAwesome;
  121. content: "\f167";
  122. }
  123. .author-box .icon-pinterest-logo::before {
  124. font-family: FontAwesome;
  125. content: "\f231";
  126. }
  127. .author-box .icon-amazon-logo::before {
  128. font-family: FontAwesome;
  129. content: "\f270";
  130. }
  131. .author-box .icon-github-logo::before {
  132. font-family: FontAwesome;
  133. content: "\f09b";
  134. }
.author-box .author-name { /*ニックネームのスタイル指定*/
  font-size: 1em;
  font-weight: normal;
  margin-bottom: 0;
}
.author-name a {
  text-decoration: none;
  color: #333; /*ニックネームの文字色*/
}
.author-widget-name { /*肩書きのスタイル指定*/
  font-size: 0.8em;
  color: #bbb;
}
.author-box p { /*プロフィール文のスタイル指定*/
  margin-top: 1em;
  line-height: 1.5;
  font-size: 0.9em;
}
.author-box { /*全体を囲むボックスのスタイル指定*/
  border: none;
  border-top: 1px solid #72c7e6;
  margin: 1em 0;
  padding: 30px 2% 1.8%;
  line-height: 1.4;
  position: relative;
}
.author-box::after { /*全体を囲むボックス上部の見出し設定*/
  content: "ABOUT ME";
  font-size: 14px;
  background: #72c7e6;
  border-radius: 0 0 10px 10px;
  color: #fff;
  padding: 6px 20px;
  position: absolute;
  top: 0;
  right: 0;
}
.author-follows {
  background: none;
  margin: 0; 
  padding: 0;
}
.author-box .sns-follow-message {
  display: none;
}
.author-box .sns-follow-buttons a.follow-button { /*フォローボタンのスタイル指定*/
  font-size: 18px;
  width: 36px; 
  height: 36px;
  border-radius: 50%;
  margin-bottom: 4px;
  margin-right: 4px;
  background: #72c7e6; /*フォローボタン背景*/
  color: #fff; /*アイコンの色*/
  border: none; /*ボーダーの指定*/
  transition: .5s;
}
.author-box .sns-follow-buttons a.follow-button:hover {
  background: #2ea5d0; /*フォローボタンのマウスホバー時の背景色*/
  opacity: 1;
}
.author-box a.follow-button span {
  line-height: 32px;
}
@media screen and (max-width: 480px){
.author-box {
  text-align: center;
  font-size: 0.9em;
}
.author-box::after {
  right: auto;
  left: 0;
}
.author-thumb {
  float: none;
  margin-top: 3px;
  width: 120px;
  display: inline-block;
}
.author-box .author-thumb {
  float: none;
  margin-top: 3px;
  width: 120px;
}
.author-box .author-thumb img {
  margin: 0 auto;
}
.author-box .author-content {
  margin: 0;
}
.author-description {
  text-align: left;
}
.author-box .sns-follow-buttons {
  justify-content: center;
}
}
.author-box .icon-twitter-logo::before {
  font-family: FontAwesome;
  content: "\f099"
}
.author-box .icon-facebook-logo::before {
  font-family: FontAwesome;
  content: "\f09a";
}
.author-box .icon-instagram-new::before {
  font-family: FontAwesome;
  content: "\f16d";
}
.author-box .icon-hatebu-logo::before {
  font-family: Verdana;
  content: 'B!';
  font-weight: bold;
}
.author-box .icon-google-plus-logo::before {
  font-family: FontAwesome;
  content: "\f0d5";
}
.author-box .icon-youtube-logo::before {
  font-family: FontAwesome;
  content: "\f167";
}
.author-box .icon-pinterest-logo::before {
  font-family: FontAwesome;
  content: "\f231";
}
.author-box .icon-amazon-logo::before {
  font-family: FontAwesome;
  content: "\f270";
}
.author-box .icon-github-logo::before {
  font-family: FontAwesome;
  content: "\f09b";
}

記事下のウィジェットを設定する

管理画面のメニューから「ウィジェット」のページを開いて「投稿本文下」に「[c]プロフィール」を追加します↓

サイドバーの時と内容は同じですが、ウィジェットを置く場所は「投稿SNSボタン下」や「投稿コメントフォーム下」など好きな場所で大丈夫です。

「保存」ボタンを押したら適当なページを開いてちゃんと表示されているか確認してみてください↓

サイドバーと記事下の両方に表示する場合

両方に表示する場合は、以下のコードを使用してください。

  • CSS
  1. .author-box .author-name {
  2. font-size: 1em;
  3. font-weight: normal;
  4. margin-bottom: 0;
  5. }
  6. .author-name a {
  7. text-decoration: none;
  8. color: #333;
  9. }
  10. .author-widget-name {
  11. font-size: 0.8em;
  12. color: #bbb;
  13. }
  14. .author-box p {
  15. margin-top: 2em;
  16. line-height: 1.5;
  17. font-size: 0.9em;
  18. }
  19. .author-box {
  20. border: 1px solid #eee;
  21. border-radius: 4px;
  22. margin: 1em 0;
  23. line-height: 1.4;
  24. position: relative;
  25. padding: 1.4% 2% 1.8%;
  26. }
  27. .author-follows {
  28. background: #72c7e6;
  29. margin: 0 -20px -20px -20px;
  30. padding: 20px 0;
  31. }
  32. .author-box .sns-follow-message {
  33. display: block;
  34. color: #fff;
  35. }
  36. .author-box .sns-follow-buttons a.follow-button {
  37. font-size: 18px;
  38. width: 36px;
  39. height: 36px;
  40. border-radius: 50%;
  41. margin-bottom: 4px;
  42. margin-right: 4px;
  43. background: none;
  44. color: #fff;
  45. border: 1px solid #fff;
  46. transition: .5s;
  47. }
  48. .author-box .sns-follow-buttons a.follow-button:hover {
  49. background: #2ea5d0;
  50. opacity: 1;
  51. }
  52. .author-box a.follow-button span {
  53. line-height: 32px;
  54. }
  55. main .author-box p {
  56. margin-top: 1em;
  57. }
  58. main .author-box {
  59. border: none;
  60. border-top: 1px solid #72c7e6;
  61. border-radius: 0;
  62. padding-top: 30px;
  63. }
  64. main .author-box::after {
  65. content: "ABOUT ME";
  66. font-size: 14px;
  67. background: #72c7e6;
  68. border-radius: 0 0 10px 10px;
  69. color: #fff;
  70. padding: 6px 20px;
  71. position: absolute;
  72. top: 0;
  73. right: 0;
  74. }
  75. main .author-follows {
  76. background: none;
  77. margin: 0;
  78. padding: 0;
  79. }
  80. main .author-box .sns-follow-buttons a.follow-button {
  81. background: #72c7e6;
  82. border: none;
  83. }
  84. main .author-box .sns-follow-message {
  85. display: none;
  86. }
  87. @media screen and (max-width: 480px){
  88. main .author-box {
  89. text-align: center;
  90. font-size: 0.9em;
  91. }
  92. main .author-box::after {
  93. right: auto;
  94. left: 0;
  95. }
  96. main .author-thumb {
  97. float: none;
  98. margin-top: 3px;
  99. width: 120px;
  100. display: inline-block;
  101. }
  102. main .author-box .author-thumb {
  103. float: none;
  104. margin-top: 3px;
  105. width: 120px;
  106. }
  107. main .author-box .author-thumb img {
  108. margin: 0 auto;
  109. }
  110. main .author-box .author-content {
  111. margin: 0;
  112. }
  113. main .author-description {
  114. text-align: left;
  115. }
  116. main .author-box .sns-follow-buttons {
  117. justify-content: center;
  118. }
  119. }
  120. .author-box .icon-twitter-logo::before {
  121. font-family: FontAwesome;
  122. content: "\f099"
  123. }
  124. .author-box .icon-facebook-logo::before {
  125. font-family: FontAwesome;
  126. content: "\f09a";
  127. }
  128. .author-box .icon-instagram-new::before {
  129. font-family: FontAwesome;
  130. content: "\f16d";
  131. }
  132. .author-box .icon-hatebu-logo::before {
  133. font-family: Verdana;
  134. content: 'B!';
  135. font-weight: bold;
  136. }
  137. .author-box .icon-google-plus-logo::before {
  138. font-family: FontAwesome;
  139. content: "\f0d5";
  140. }
  141. .author-box .icon-youtube-logo::before {
  142. font-family: FontAwesome;
  143. content: "\f167";
  144. }
  145. .author-box .icon-pinterest-logo::before {
  146. font-family: FontAwesome;
  147. content: "\f231";
  148. }
  149. .author-box .icon-amazon-logo::before {
  150. font-family: FontAwesome;
  151. content: "\f270";
  152. }
  153. .author-box .icon-github-logo::before {
  154. font-family: FontAwesome;
  155. content: "\f09b";
  156. }
.author-box .author-name {
  font-size: 1em;
  font-weight: normal;
  margin-bottom: 0;
}
.author-name a {
  text-decoration: none;
  color: #333;
}
.author-widget-name {
  font-size: 0.8em;
  color: #bbb;
}
.author-box p {
  margin-top: 2em;
  line-height: 1.5;
  font-size: 0.9em;
}
.author-box {
  border: 1px solid #eee;
  border-radius: 4px;
  margin: 1em 0;
  line-height: 1.4;
  position: relative;
  padding: 1.4% 2% 1.8%;
}
.author-follows {
  background: #72c7e6;
  margin: 0 -20px -20px -20px; 
  padding: 20px 0;
}
.author-box .sns-follow-message {
  display: block;
  color: #fff; 
}
.author-box .sns-follow-buttons a.follow-button {
  font-size: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  margin-bottom: 4px;
  margin-right: 4px;
  background: none;
  color: #fff;
  border: 1px solid #fff;
  transition: .5s;
}
.author-box .sns-follow-buttons a.follow-button:hover {
  background: #2ea5d0;
  opacity: 1;
}
.author-box a.follow-button span {
  line-height: 32px;
}
main .author-box p {
  margin-top: 1em;
}
main .author-box {
  border: none;
  border-top: 1px solid #72c7e6;
  border-radius: 0;
  padding-top: 30px;
}
main .author-box::after {
  content: "ABOUT ME";
  font-size: 14px;
  background: #72c7e6;
  border-radius: 0 0 10px 10px;
  color: #fff;
  padding: 6px 20px;
  position: absolute;
  top: 0;
  right: 0;
}
main .author-follows {
  background: none;
  margin: 0; 
  padding: 0;
}
main .author-box .sns-follow-buttons a.follow-button {
  background: #72c7e6;
  border: none;
}
main .author-box .sns-follow-message {
  display: none;
}
@media screen and (max-width: 480px){
main .author-box {
  text-align: center;
  font-size: 0.9em;
}
main .author-box::after {
  right: auto;
  left: 0;
}
main .author-thumb {
  float: none;
  margin-top: 3px;
  width: 120px;
  display: inline-block;
}
main .author-box .author-thumb {
  float: none;
  margin-top: 3px;
  width: 120px;
}
main .author-box .author-thumb img {
  margin: 0 auto;
}
main .author-box .author-content {
  margin: 0;
}
main .author-description {
  text-align: left;
}
main .author-box .sns-follow-buttons {
  justify-content: center;
}
}
.author-box .icon-twitter-logo::before {
  font-family: FontAwesome;
  content: "\f099"
}
.author-box .icon-facebook-logo::before {
  font-family: FontAwesome;
  content: "\f09a";
}
.author-box .icon-instagram-new::before {
  font-family: FontAwesome;
  content: "\f16d";
}
.author-box .icon-hatebu-logo::before {
  font-family: Verdana;
  content: 'B!';
  font-weight: bold;
}
.author-box .icon-google-plus-logo::before {
  font-family: FontAwesome;
  content: "\f0d5";
}
.author-box .icon-youtube-logo::before {
  font-family: FontAwesome;
  content: "\f167";
}
.author-box .icon-pinterest-logo::before {
  font-family: FontAwesome;
  content: "\f231";
}
.author-box .icon-amazon-logo::before {
  font-family: FontAwesome;
  content: "\f270";
}
.author-box .icon-github-logo::before {
  font-family: FontAwesome;
  content: "\f09b";
}

プロフィール詳細のボタンを表示する場合

こんな感じにプロフィールページへ飛ばすリンクをボタンにすることもできます。

やり方は「SANGO」風カスタマイズ記事の最後の部分で紹介していますので参考にしてみてください↓

まとめ

今回は「JIN」風のカスタマイズ方法のご紹介でした。「SANGO」風のカスタマイズと混ぜたりしてもオリジナリティが出て面白いかと思います。

皆さんも挑戦してみてくださいね!ではまた〜♪

WordPress
\記事が役に立ったらシェアしてね/
うぇぶあしび

comment

  1. のり より:

    お世話になります。
    CSS初心者なので、いつも参考にさせていただいております。
    本記事を参考にプロフィールをカスタマイズしてみたのですが、サイドバーにおいて、SNSフォローボタンの上のメッセージが「〇〇(ニックネーム)をフォローする」になってしまいます。
    お手本のように「\Follw me/」とするには、どのような手入れをしたらよいでしょうか。
    色々いじってみてもうまくいかず、恥ずかしながらこちらで質問させていただきます。
    見落とし等ありましたら申し訳ありません。

    • DICEDICE より:

      こんにちは!説明不足ですいません^^;

      Cocoon設定 > SNSフォロー にある「フォローメッセージ」の内容が反映されますので確認してみてください。

タイトルとURLをコピーしました