• Resolved snowme

    (@snowme)


    Hi,

    I was wondering if there was a way to show the Featured Image Thumbnail next to the Post Title on the actual Post page.

    I have the Thumbnail showing on the main page next to the title. I would like the same thing to show on the Post page.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Theme Author nobita

    (@nobita)

    Hi

    functions.php line:1 add below PHP code.

    function raindrops_prev_next_post( $position = "nav-above" ) {
    
    	$previous_image	 = '';
    	$next_image		 = '';
    
    	if ( is_category() ) {
    
    		$filter = true; //display same category.
    	} else {
    
    		$filter = false;
    	}
    	if ( !is_single() ) {
    		return $original;
    	} else {
    
    		$previous	 = get_adjacent_post( false, '', true );
    		$next		 = get_adjacent_post( false, '', false );
    
    		if ( has_post_thumbnail( $previous->ID ) ) {
    
    			$previous_image = get_the_post_thumbnail( $previous->ID, array( 48, 48 ) );
    		}
    		if ( has_post_thumbnail( $next->ID ) ) {
    
    			$next_image = get_the_post_thumbnail( $next->ID, array( 48, 48 ) );
    		}
    	}
    	//exclude separate 'and'
    	$exclude_category	 = apply_filters( 'raindrops_next_prev_excluded_categories', '' );
    	$html				 = '<div id="%1$s" class="%2$s"><span class="%3$s">';
    	printf( $html, $position, "clearfix", "nav-previous" );
    	previous_post_link( '%link', $previous_image . '<span class="button"><span class="meta-nav">&laquo;</span> %title</span>', $filter, $exclude_category );
    	$html				 = '</span><div class="%1$s">';
    	printf( $html, "nav-next" );
    	next_post_link( '%link', '<span class="button"> %title <span class="meta-nav">&raquo;</span></span>' . $next_image, $filter, $exclude_category );
    	$html				 = '</div></div>';
    	echo apply_filters( "raindrops_prev_next_post", $html );
    }

    Add Child Theme style.css bottom

    .single #nav-below{
        margin-top:1em;
        position:relative;
    }
    .single .nav-next .button{
       margin-right:50px;
    }
    .single .nav-previous .button{
        margin-left:50px;
    }
    .single .nav-next a:after,
    .single .nav-previous a:before{
        display:none;
    }
    .single .nav-next img{
        position:absolute;
        right:0;
    }
    .single .nav-previous img{
       position:absolute;
       left:0;
    }

    thank you.

    Thread Starter snowme

    (@snowme)

    Hi Nobita,

    I tried out the mod you suggested but the Thumbnail is actually only showing up at the bottom of the post where you can select newer or older posts. It’s not showing up at the top of the post where the Post Title is.

    Thanks

    Theme Author nobita

    (@nobita)

    Thread Starter snowme

    (@snowme)

    I think you misunderstood me. I want the thumbnail to show up at the top of the page next to the Post Title.

    Theme Author nobita

    (@nobita)

    I’m sorry, Please explain in the pages of your web site.

    Please tell me your WEB site.

    Thread Starter snowme

    (@snowme)

    The first link shows my Main Page with a preview of the Post. It has the Featured thumbnail next to the title.

    Main Page with Thumbnail

    The second link shows the Post Page with no thumbnail next to the title.

    Post Page with no Thumbnail

    If possible, I’d like the Post Page to look like the Main Page preview

    Theme Author nobita

    (@nobita)

    Plese try below

    Add your child theme functions.php

    <?php
    
    	function raindrops_fallback_title( $title, $id = 0 ) {
    
    		global $post, $raindrops_link_unique_text;
    		$format_label = '';
    
    		if ( 0 == $id && is_object( $post ) ) {
    
    			$id = $post->ID;
    		}
    		//@ 1.317
    		$id = absint( $id );
    
    		if ( !is_admin() ) {
    
    			$format = get_post_format( $id );
    
    			if ( false === $format ) {
    
    				$image_uri		 = get_template_directory_uri() . '/images/link.png';
    				$class			 = 'icon-link-no-title';
    				$format_label	 = 'Article';
    			} else {
    
    				$image_uri	 = get_template_directory_uri() . '/images/post-format-' . $format . '.png';
    				$class		 = 'icon-post-format-notitle icon-post-format-' . $format;
    
    				if ( 'link' == $format ) {
    
    					$add_label = ' to entry';
    				} else {
    
    					$add_label = '';
    				}
    				$format_label = 'Post Format ' . esc_attr( $format ) . $add_label;
    			}
    
    			$raindrops_post_thumbnail_size =  array( 48, 48 );
    
    			if ( in_the_loop() ) {
    
    				//@ 1.317	$raindrops_post_thumbnail_size =  apply_filters( 'raindrops_post_thumbnail_size_main_query', array( 48, 48 ), $post->ID, get_post_class( '', $post->ID ) );
    				$raindrops_post_thumbnail_size =  apply_filters( 'raindrops_post_thumbnail_size_main_query', array( 48, 48 ), $id, get_post_class( '', $id ) );
    			}
    
    			$thumbnail = '';
    			//@ 1.317	if (  in_the_loop()  && has_post_thumbnail( $post->ID ) && !post_password_required()  && !is_singular() ) {
    			if (  in_the_loop()  && has_post_thumbnail( $id ) && !post_password_required()  ) {
    				$thumbnail .= '<span class="h2-thumb">';
    				$thumbnail .= get_the_post_thumbnail( $post->ID, $raindrops_post_thumbnail_size, array( "style" => "vertical-align:middle;", "alt" => null ) );
    				$thumbnail .= '</span>';
    			}
    			//@ 1.317	if (isset( $post->ID ) && ! is_404() && !has_post_thumbnail( $post->ID ) && !is_singular() && !post_password_required() ) {
    			if (isset( $id ) && ! is_404() && !has_post_thumbnail( $id ) && !is_singular() && !post_password_required() ) {
    
    				$thumbnail =  apply_filters('raindrops_title_thumbnail', $thumbnail ,'<span class="h2-thumb">', '</span>');
    			}
    			if (  in_the_loop() ) {
    
    				$raindrops_entry_title_text_allow = apply_filters( 'raindrops_entry_title_text_elements_allow', true );
    
    				if ( true == $raindrops_entry_title_text_allow ) {
    
    					$title =  $thumbnail. '<span class="entry-title-text">'.$title.'</span>';
    				} else {
    
    					$title =  $thumbnail. $title ;
    				}
    			} else {
    
    				$title =  $thumbnail. $title;
    			}
    
    			$striped_title = wp_kses( $title,array());
    
    			if ( empty( $title )  || empty( $striped_title ) ) {
    
    				$html = $thumbnail. '<span class="' . esc_attr( $class ) . '" title="' . $format_label . '" ></span>';
    				return $html;
    			}
    		}
    		$raindrops_link_unique_text = raindrops_link_unique_text();
    
    		//@ 1.317	if ( isset( $post->ID ) && $raindrops_link_unique_text == true ) {
    		if ( isset( $id ) && $raindrops_link_unique_text == true ) {
    			 $title = $title. raindrops_unique_entry_title(  $id );
    		}
    
    		return apply_filters( 'raindrops_fallback_title', $title );
    	}
    ?>
    Thread Starter snowme

    (@snowme)

    Hi,

    The change works but it seems to also affect the bottom links as well. Is there a way to make the change only affect the top title and not the bottom links.

    Bottom Links Before:
    Before Change

    Bottom Links After:
    After Change

    Thanks again for all your hard work.

    Theme Author nobita

    (@nobita)

    Please give a little time, because think about the other way,

    Until then, please take the following method

    Please hide using CSS

    Please add child theme style.css

    #nav-below .h2-thumb{
        display:none;
    }

    Theme Author nobita

    (@nobita)

    Remove all customize code.

    Change template.

    copy with raw button

    https://gist.github.com/tenman/ffe98d2feb4ca617d826

    Add child-theme / part.php

    Thread Starter snowme

    (@snowme)

    Thanks so much. Yeah I forgot to remove the previous CSS changes before adding in your new ones. I removed the old changes and hid the thumbnail from the bottom and it works great now.

    Thanks for providing such excellent support!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Featured Image Thumbnail on Post Page’ is closed to new replies.