Suffusion theme skills

2011-06-03


We posted “Basic Settings of WordPress Suffusion theme”. Now we will share some skills which we learnt. Maybe they are simple, but maybe you don’t know.

1: Header Background Image height ?

You might have added a image for your header background, but you meet a trouble that you have already set the image height, but the header part looks like not work well, or maybe you see the are more space under your header.

All the height trouble come from you actually did not set a correct height for your header background image height.

Please read their description for Height of the Header image:

… you can change this setting if you have a header image needs to fit. Note that both above and below the header is 15px of padding, making the effective height of the header 85px.

suffusion08

So if your header image is 55px high, actually your header section height will be 55px + 15px + 15px = 85px, so here you should fill a number which is your exact image height minus 30px, or even you can minus more so that you can get a perfect header height and space between header and main content.
**
2: Problem when modify Single.php**

If you want to change something in Single.php file, and if you want to modify this file in WordPress management dashboard, you will meet a problem which you must be confused by it: you changed something, but you will never get the correct result.

The reason is this Single.php file which you are modifying is NOT the Single.php which you want to modify. this file you are working is located in the folder “now-reading” but not in the folder suffusion.

suffusion09

The simple solution is that just cut off “now-reading/” from URL which in the top URL place in your web browser, then click Enter, you will see the exact Single.php file which you want.

**
3: Add a “XX Views” for each post:**

Want a views number for each post like following ?

suffusion10

Install a view plugin which is able to enable the function the_views(), such as the plugin WP-PostViews.

Go to Suffusion theme folder and find a file named “actions.php”, or you can find it in your WordPress admin panel Editor.

open this file, located a function “suffusion_post_footer()”, find a place which you want and insert the following code:

   1:  <!-- my code begin -->
   2:  <span><?php if(function_exists('the_views')) { the_views(); } ?></span>
   3:  <!-- my code end –>

**

4: Insert Google AdSense between excerpt posts in Home page:**

Insert a AdSense block between post block in Home page just like below:

suffusion11

Find layout-blog.php file and open it, locate the following code:

   1:  global $post;
   2:  if (have_posts()) {
   3:      $full_content_post_counter = 0;
   4:      $full_post_count = suffusion_get_full_content_count();
   5:      while (have_posts()) {
   6:          the_post();

Followed the above code, insert your AdSense code block, but you have to add php script also, check following sample code:

   1:  //My code start
   2:  if ($wp_query->current_post == 1 ) {
   3:  ?>
   4:   
   5:  <!-- your AdSense code here -->
   6:   
   7:  <?php
   8:  }
   9:  //My code End