Welcome to PressWork!

Want to ask a question or join the discussion? Great! Join now.

In this Discussion

How to remove title att from featured posts thumb
  • Hi, is there any way to remove the title attribute from posts thumbs? I don't want to see the filename of img on hover. Can you please help me? Regards
  • cestbibicestbibi
    This answer was Accepted.
    You need replace
    the_post_thumbnail($thumb, array('class'=>$class));

    with this:
    the_post_thumbnail($thumb, array('class'=>$class, 'title' => ""));


    If you don't now how to do this, read this thread : http://presswork.me/2011/custom-css-and-custom-actions/
    and paste the following code in your custom actions
    <?php
    remove_action('pw_index_sticky_post_middle', 'pw_posts_featured');
    remove_action('pw_index_featured_post_middle', 'pw_posts_featured');
    /*
    * Get rid of the thumbnail title for Featured Posts
    */

    function custom_posts_featured() {
    echo pw_function_handle(__FUNCTION__);
    global $pw;
    $rightcon = '';
    if(function_exists('has_post_thumbnail') && has_post_thumbnail() && (function_exists('has_post_format') && !has_post_format('gallery') && !has_post_format('video'))) {
    echo '<a href="'.get_permalink().'">';
    if($pw==1) { $thumb = 'sticky'; $class = 'alignnone'; } else { $thumb = 'thumbnail'; $class = 'alignleft'; }
    the_post_thumbnail($thumb, array('class'=>$class, 'title' => ""));
    echo '</a>';
    $rightcon = ' class="content-col"';
    }
    ?>
    <div<?php echo $rightcon; ?>>
    <header>
    <hgroup>
    <h1 class="posttitle"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', "presswork" ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
    <h2 class="meta">
    <?php
    _e("by", "presswork"); echo " "; the_author_posts_link();
    echo '&nbsp;&bull;&nbsp;';
    the_time(get_option('date_format'));
    if(comments_open()) { echo '&nbsp;&bull;&nbsp;'; comments_popup_link(__('0 Comments', "presswork"),__('1 Comment', "presswork"),__('% Comments', "presswork")); }
    ?>
    </h2>
    </hgroup>
    </header>
    <div class="storycontent">
    <?php
    if(function_exists('has_post_format') &&
    (has_post_format('aside') || has_post_format('link') || has_post_format('video') || has_post_format('image') || has_post_format('audio'))) {
    // new aside || link || audio || video || image post format
    echo '<div class="pformat clear">';
    the_content('');
    echo '</div>';
    } elseif(function_exists('has_post_format') && has_post_format('gallery')) { // new gallery post format
    global $post;
    $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
    if ( $images ) :
    $total_images = count( $images );
    $image = array_shift( $images );
    $image_img_tag = wp_get_attachment_image( $image->ID, 'full' );
    ?>
    <a class="gallery-thumb" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
    <p class="gallery-text clear fl"><em><?php printf( _n( 'This gallery contains <a %1$s>%2$s photo &rarr;</a>', 'This gallery contains <a %1$s>%2$s photos &rarr;</a>', $total_images, "presswork" ),
    'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', "presswork" ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
    number_format_i18n( $total_images )
    ); ?></em>
    </p>
    <?php endif; ?>
    <?php
    } else {
    the_excerpt();
    echo '<a href="'.get_permalink().'" class="more-link">'.__("Read more &rarr;", "presswork").'</a>';
    ?>
    <?php } ?>
    </div>
    </div>
    <?php
    }
    add_action('pw_index_sticky_post_middle', 'custom_posts_featured');
    add_action('pw_index_featured_post_middle', 'custom_posts_featured'); ?>


    This should be it.
    Post edited by cestbibi at 2011-12-02 13:03:29
    image PressWork Support Moderator
  • Indeed it works. So easy.. :) Thanks!