WordPress.org

Ready to get started?Download WordPress

Forums

Spun
[resolved] Circles with page title only (3 posts)

  1. psce
    Member
    Posted 7 months ago #

    When I add an image to a post, the image automatically appears in the circle. And I want to the image shouldn't appear.

    My site is, biensajans.com

    Someone help me? Thanks...

  2. Andrew
    Forum Moderator
    Posted 7 months ago #

    Copy 'content-home.php' from the Spun theme and paste it into your Child Theme.

    Then replace all of that file's code with the following code:

    <?php
    /**
     * @package Spun
     * @since Spun 1.0
     */
    
    /*
     * Get the post thumbnail; if one does not exist, try to get the first attached image.
     * If no images exist, let's print the post title instead.
     */
    
    global $post;
    $postclass = '';
    
    if ( '' != get_the_post_thumbnail() ) {
    	$thumb = get_the_post_thumbnail( $post->ID, 'post-thumbnail', array( 'title' => esc_attr( get_the_title() ) ) );
    }
    else {
    	$args = array(
    				'post_type' => 'attachment',
    				'numberposts' => 1,
    				'post_status' => null,
    				'post_mime_type' => 'image',
    				'post_parent' => $post->ID,
    			);
    
    	$first_attachment = '';
    
    	if ( $first_attachment ) {
    		foreach ( $first_attachment as $attachment ) {
    			$thumb = wp_get_attachment_image( $attachment->ID, 'post-thumbnail', false, array( 'title' => esc_attr( get_the_title() ) ) );
    		}
    	}
    	else {
    		$thumb = '<span class="no-thumbnail">' . get_the_title() . '</span>';
    		$postclass = 'no-thumbnail';
    	}
    }
    ?>
    
    <article id="post-<?php the_ID(); ?>" <?php post_class( $postclass ); ?>>
    	<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php echo $thumb; ?></a>
    </article><!-- #post-<?php the_ID(); ?> -->
  3. psce
    Member
    Posted 7 months ago #

    That's worked. Thank you very much...

Reply

You must log in to post.

About this Theme

About this Topic