Page 1 of 4 123 ... LastLast
Results 1 to 10 of 31
Like Tree2Likes

Thread: Categories default images - Solution

  1. #1
    dikiyforester's Avatar
    Join Date
    Oct 2011
    Location
    Russian Federation
    Posts
    2,229
    Thanks
    89
    Thanked 593 Times in 491 Posts

    Lightbulb Categories default images - Solution

    Hi, this is my solution to add the default image for categories. Tested on WP 3.3.1 and CP 3.1.6

    I installed the plugin, which automatically display a default Post Thumbnail image.
    You can download it here
    http://wordpress.org/extend/plugins/...humbnail-plus/

    Edit the plugin settings by visiting Settings -> Default Thumb Plus

    Example of configuration:
    2012-02-03 20h56_03.jpg

    The plugin works great, but ClassiPress not give him a demonstrate it.

    Need to modify the file \classipress\includes\theme-functions.php:

    1. Ad loop thumbnails
    function
    cp_ad_loop_thumbnail()
    Find:
    Code:
            // no image so return the placeholder thumbnail        
             } else {
                 echo '<a href="'. get_permalink() .'" title="'. the_title_attribute('echo=0') .'"><img class="attachment-medium" alt="" title="" src="'. get_bloginfo('template_url') .'/images/no-thumb-75.jpg" /></a>';
            }

    Replace with:
    Code:
            // no image so return the placeholder thumbnail        
             } else {
                echo '<a href="'. get_permalink() .'" title="'. the_title_attribute('echo=0') .'">';
                // if category thumbnail is set 
                if ( get_the_post_thumbnail( $post->ID, 'ad-thumb' ) ) echo get_the_post_thumbnail( $post->ID, 'ad-thumb' ); 
                // default ClassiPress thumbnail
                else echo '<img class="attachment-medium" alt="" title="" src="'. get_bloginfo('template_url') .'/images/no-thumb-75.jpg" />'; 
                echo '</a>';
             }


    2. Featured thumbnails
    function cp_ad_featured_thumbnail()
    Find:
    Code:
            // no image so return the placeholder thumbnail        
             } else {
                 echo '<a href="'. get_permalink() .'" title="'. the_title_attribute('echo=0') .'"><img class="attachment-sidebar-thumbnail" alt="" title="" src="'. get_bloginfo('template_url') .'/images/no-thumb-sm.jpg" /></a>';
             }

    Replace with:
    Code:
            // no image so return the placeholder thumbnail         
             } else {
                echo '<a href="'. get_permalink() .'" title="'. the_title_attribute('echo=0') .'">';
                // if category thumbnail is set 
                if ( get_the_post_thumbnail( $post->ID, 'sidebar-thumbnail' ) ) echo get_the_post_thumbnail( $post->ID, 'sidebar-thumbnail' ); 
                // default ClassiPress thumbnail
                else echo '<img class="attachment-sidebar-thumbnail" alt="" title="" src="'. get_bloginfo('template_url') .'/images/no-thumb-sm.jpg" />'; 
                echo '</a>';
            }


    3. Single ad thumbnails
    function cp_get_image_url()
    Find:

    Code:
            // no image so return the placeholder thumbnail        
             } else {
                echo '<img class="attachment-medium" alt="" title="" src="'. get_bloginfo('template_url') .'/images/no-thumb.jpg" />';
              
            }
    Replace with:
    Code:
            // no image so return the placeholder thumbnail        
             } else {
          
                // if category thumbnail is set 
                if ( get_the_post_thumbnail( $post->ID, 'medium' ) ) echo get_the_post_thumbnail( $post->ID, 'medium' );
                // default ClassiPress thumbnail
                else echo '<img class="attachment-medium" alt="" title="" src="'. get_bloginfo('template_url') .'/images/no-thumb.jpg" />'; 
                
            }

    That's all
    Do not forget to thank the author of the plugin 'Default Thumbnail Plus'!
    commanches likes this.

  2. The Following 3 Users Say Thank You to dikiyforester For This Useful Post:

    Florin (February 8th, 2012), marlonsabala (February 27th, 2012), rashob (March 29th, 2012)

  3. #2
    dikiyforester's Avatar
    Join Date
    Oct 2011
    Location
    Russian Federation
    Posts
    2,229
    Thanks
    89
    Thanked 593 Times in 491 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  4. #3
    harryriegel's Avatar
    Join Date
    Jan 2012
    Location
    Germany
    Posts
    37
    Thanks
    3
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  5. #4
    harryriegel's Avatar
    Join Date
    Jan 2012
    Location
    Germany
    Posts
    37
    Thanks
    3
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  6. #5
    dikiyforester's Avatar
    Join Date
    Oct 2011
    Location
    Russian Federation
    Posts
    2,229
    Thanks
    89
    Thanked 593 Times in 491 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    arthemes.org - AppThemes plugins, tutorials, modifications and services

  7. The Following User Says Thank You to dikiyforester For This Useful Post:

    vienna (February 9th, 2012)

  8. #6
    Junior Member Florin's Avatar
    Join Date
    Mar 2011
    Location
    Romania
    Posts
    25
    Thanks
    7
    Thanked 3 Times in 3 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  9. #7
    Veteran vienna's Avatar
    Join Date
    May 2010
    Location
    Vienna, Austria
    Posts
    718
    Thanks
    19
    Thanked 177 Times in 118 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  10. #8
    Junior Member marlonsabala's Avatar
    Join Date
    Feb 2012
    Location
    Portugal
    Posts
    27
    Thanks
    5
    Thanked 9 Times in 5 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  11. #9
    Veteran vienna's Avatar
    Join Date
    May 2010
    Location
    Vienna, Austria
    Posts
    718
    Thanks
    19
    Thanked 177 Times in 118 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  12. #10
    dikiyforester's Avatar
    Join Date
    Oct 2011
    Location
    Russian Federation
    Posts
    2,229
    Thanks
    89
    Thanked 593 Times in 491 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    arthemes.org - AppThemes plugins, tutorials, modifications and services

Page 1 of 4 123 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Categories default images
    By Florin in forum ClassiPress General Discussion
    Replies: 3
    Last Post: December 11th, 2016, 11:26 AM
  2. [SOLUTION] Migrating categories using MySQL
    By sciamannikoo in forum Report ClassiPress Bugs
    Replies: 19
    Last Post: March 20th, 2013, 04:50 AM
  3. Removing default thumbnail when ad has no images
    By youna in forum ClassiPress General Discussion
    Replies: 9
    Last Post: April 28th, 2012, 09:59 AM