0

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"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h1>

            <?php if ( 'post' == get_post_type() ) : ?>
            <div class="entry-meta">
                <?php mytheme_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', 'mytheme' ), esc_html__( '1 Comment', 'mytheme' ), esc_html__( '% Comments', 'mytheme' ) ); ?></span>
            <?php endif; ?>

            <?php edit_post_link( esc_html__( 'Edit', 'mytheme' ), '<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(); ?>
            <a class="details-btn" href="<?php the_permalink(); ?>" target="_blank"><?php _e( 'Read in new tab', 'mytheme' ); ?> <i class="fa fa-chevron-right"></i></a>
        </div><!-- .entry-summary -->
        <?php else : ?>
        <div class="entry-content">

            <?php if ( has_post_thumbnail()) : ?>
            <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
                <?php the_post_thumbnail( 'mytheme-featured', array( 'class' => 'single-featured col-sm-5' )); ?>
            </a>
            <div class="col-sm-7">
                <?php the_excerpt(); ?>
            </div>
            <?php else : ?>
                <?php the_excerpt(); ?>
            <?php endif; ?>
            <a class="details-btn" href="<?php the_permalink(); ?>" target="_blank"><?php _e( 'Read in new tab', 'mytheme' ); ?> <i class="fa fa-chevron-right"></i></a>

            <?php
                wp_link_pages( array(
                    'before'            => '<div class="page-links">'.__( 'Pages:', 'mytheme' ),
                    'after'             => '</div>',
                    'link_before'       => '<span>',
                    'link_after'        => '</span>',
                    'pagelink'          => '%',
                    'echo'              => 1
                ) );
            ?>
        </div><!-- .entry-content -->
        <?php endif; ?>
    </div>
</div>

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

  • The if ( is_search() ) : block is clearly marked. – s_ha_dum Dec 31 '15 at 15:26
  • Please reply me with correct code. – azizul Dec 31 '15 at 17:14
  • This site doesn't operate on a "do my work for me" basis. You are generally expected to have a go (and to be able to have a go). – Andy Macaulay-Brook Jul 23 '16 at 14:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.