• Azizul Karim

    (@azizul-karim-aec)


    I want same front page content for post front page, search page and jetpack-portfolio page. Currently search page not displaying post thumbnail and jetpack-portfolio page not displaying entry-meta.

    This is current theme content page. I have customized it a little.

    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    	<div class="blog-item-wrap">
    
    		<div class="post-inner-content">
    			<header class="entry-header page-header">
    
    				<h1 class="entry-title">" rel="bookmark"><?php the_title(); ?></h1>
    
    				<?php if ( 'post' == get_post_type() ) : ?>
    				<div class="entry-meta">
    					<?php sparkling_posted_on(); ?><?php if ( ! post_password_required() && ( comments_open() || '0' != get_comments_number() ) ) : ?>
    				<span class="comments-link"><i class="fa fa-comment-o"></i><?php comments_popup_link( esc_html__( 'Leave a comment', 'sparkling' ), esc_html__( '1 Comment', 'sparkling' ), esc_html__( '% Comments', 'sparkling' ) ); ?></span>
    				<?php endif; ?>
    
    				<?php edit_post_link( esc_html__( 'Edit', 'sparkling' ), '<i class="fa fa-pencil-square-o"></i><span class="edit-link">', '</span>' ); ?>
    
    				</div><!-- .entry-meta -->
    				<?php endif; ?>
    			</header><!-- .entry-header -->
    
    			<?php if ( is_search() ) : // Only display Excerpts for Search ?>
    			<div class="entry-summary">
    				<?php the_excerpt(); ?>
    				" target="_blank"><?php _e( 'Read in new tab', 'sparkling' ); ?> <i class="fa fa-chevron-right"></i>
    			</div><!-- .entry-summary -->
    			<?php else : ?>
    			<div class="entry-content">
    
    				<?php if ( has_post_thumbnail()) : ?>
    				" title="<?php the_title_attribute(); ?>" >
    				 	<?php the_post_thumbnail( 'sparkling-featured', array( 'class' => 'single-featured col-sm-5' )); ?>
    				
    				<div class="col-sm-7">
    					<?php the_excerpt(); ?>
    				</div>
    				<?php else : ?>
    					<?php the_excerpt(); ?>
    				<?php endif; ?>
    				" target="_blank"><?php _e( 'Read in new tab', 'sparkling' ); ?> <i class="fa fa-chevron-right"></i>
    
    				<?php
    					wp_link_pages( array(
    						'before'            => '<div class="page-links">'.__( 'Pages:', 'sparkling' ),
    						'after'             => '</div>',
    						'link_before'       => '<span>',
    						'link_after'        => '</span>',
    						'pagelink'          => '%',
    						'echo'              => 1
    		       		) );
    		    	?>
    			</div><!-- .entry-content -->
    			<?php endif; ?>
    		</div>
    	</div>
    </article><!-- #post-## -->

    I don’t know php well. Please help me !!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi,

    To display same content for search page and front page remove the if statement checking if(is_search()). It will also solve your problem of displaying thumbnail on search page. Your code should be like below:

    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    	<div class="blog-item-wrap">
    
    		<div class="post-inner-content">
    			<header class="entry-header page-header">
    
    				<h1 class="entry-title">" rel="bookmark"><?php the_title(); ?></h1>
    
    				<?php if ( 'post' == get_post_type() ) : ?>
    				<div class="entry-meta">
    					<?php sparkling_posted_on(); ?><?php if ( ! post_password_required() && ( comments_open() || '0' != get_comments_number() ) ) : ?>
    				<span class="comments-link"><i class="fa fa-comment-o"></i><?php comments_popup_link( esc_html__( 'Leave a comment', 'sparkling' ), esc_html__( '1 Comment', 'sparkling' ), esc_html__( '% Comments', 'sparkling' ) ); ?></span>
    				<?php endif; ?>
    
    				<?php edit_post_link( esc_html__( 'Edit', 'sparkling' ), '<i class="fa fa-pencil-square-o"></i><span class="edit-link">', '</span>' ); ?>
    
    				</div><!-- .entry-meta -->
    				<?php endif; ?>
    			</header><!-- .entry-header -->
    
    			<div class="entry-summary">
    				<?php the_excerpt(); ?>
    				" target="_blank"><?php _e( 'Read in new tab', 'sparkling' ); ?> <i class="fa fa-chevron-right"></i>
    			</div><!-- .entry-summary -->
    			<?php else : ?>
    			<div class="entry-content">
    
    				<?php if ( has_post_thumbnail()) : ?>
    				" title="<?php the_title_attribute(); ?>" >
    				 	<?php the_post_thumbnail( 'sparkling-featured', array( 'class' => 'single-featured col-sm-5' )); ?>
    
    				<div class="col-sm-7">
    					<?php the_excerpt(); ?>
    				</div>
    				<?php else : ?>
    					<?php the_excerpt(); ?>
    				<?php endif; ?>
    				" target="_blank"><?php _e( 'Read in new tab', 'sparkling' ); ?> <i class="fa fa-chevron-right"></i>
    
    				<?php
    					wp_link_pages( array(
    						'before'            => '<div class="page-links">'.__( 'Pages:', 'sparkling' ),
    						'after'             => '</div>',
    						'link_before'       => '<span>',
    						'link_after'        => '</span>',
    						'pagelink'          => '%',
    						'echo'              => 1
    		       		) );
    		    	?>
    			</div><!-- .entry-content -->
    
    		</div>
    	</div>
    </article><!-- #post-## -->
    Thread Starter Azizul Karim

    (@azizul-karim-aec)

    @falguni
    No, thats not solve my problem. This is displaying blank content.

    Are placing the code in home.php/inedex.php?
    Does this below code solve your problem?

    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    	<div class="blog-item-wrap">
    
    		<div class="post-inner-content">
    			<header class="entry-header page-header">
    
    				<h1 class="entry-title">" rel="bookmark"><?php the_title(); ?></h1>
    
    				<?php if ( 'post' == get_post_type() ) : ?>
    				<div class="entry-meta">
    					<?php sparkling_posted_on(); ?><?php if ( ! post_password_required() && ( comments_open() || '0' != get_comments_number() ) ) : ?>
    				<span class="comments-link"><i class="fa fa-comment-o"></i><?php comments_popup_link( esc_html__( 'Leave a comment', 'sparkling' ), esc_html__( '1 Comment', 'sparkling' ), esc_html__( '% Comments', 'sparkling' ) ); ?></span>
    				<?php endif; ?>
    
    				<?php edit_post_link( esc_html__( 'Edit', 'sparkling' ), '<i class="fa fa-pencil-square-o"></i><span class="edit-link">', '</span>' ); ?>
    
    				</div><!-- .entry-meta -->
    				<?php endif; ?>
    			</header><!-- .entry-header -->
    
    			<div class="entry-content">
    
    				<?php if ( has_post_thumbnail()) : ?>
    
    				 	<?php the_post_thumbnail( 'sparkling-featured', array( 'class' => 'single-featured col-sm-5' )); ?>
    
    				<?php endif; ?>
    
    				<div class="col-sm-7">
    					<?php the_content(); ?>
    				</div>
    
    				<?php
    					wp_link_pages( array(
    						'before'            => '<div class="page-links">'.__( 'Pages:', 'sparkling' ),
    						'after'             => '</div>',
    						'link_before'       => '<span>',
    						'link_after'        => '</span>',
    						'pagelink'          => '%',
    						'echo'              => 1
    		       		) );
    		    	?>
    			</div><!-- .entry-content -->
    
    		</div>
    	</div>
    </article><!-- #post-## -->

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Need help for showing same front content page, search page and portfolio post pa’ is closed to new replies.