For my client site, I am planning to enable link post image to post a link on blog list page, the site uses custom WordPress theme developed by the previous developer.
For blog post list page he created as content.php and for the single post he created content-page.php
Even if I add the featured image I can't able to see that featured image, only the image inside of the post is showing.
How to achieve this?
Here is the code for content.php
<?php
/**
* Template part for displaying posts
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package Blog
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php
if ( is_single() ) :
the_title( '<h1 class="entry-title">', '</h1>' );
else :
the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark" >', '</a></h2>' );
endif;
if ( 'post' === get_post_type() ) : ?>
<h4 class="meta text-muted">
<?php bfablog_posted_on(); ?>
</h4><!-- .entry-meta -->
<?php
endif; ?>
<!-- AddThis Button BEGIN -->
<div class="addthis_inline_share_toolbox_mzc3" style="margin-bottom:20px;" data-title="<?php the_title() ?>" data-url="<?php the_permalink(); ?>" </div>
<!-- AddThis Button END -->
</header><!-- .entry-header -->
<div class="entry-content">
<?php
the_content( sprintf (
/* translators: %s: Name of current post. */
wp_kses(__( 'Read more', 'bfablog' ), array( 'span' => array( 'class' =>
array() ) ) ),
the_title( '<span class="screen-reader-text">"', '"</span>', false )
) );
wp_link_pages( array(
'before' => '<div class= "page-links">'. esc_html__('Pages:', 'bfablog'
),
'after' => '</div>',
) );
?>
</div><!-- .entry-content -->
<footer class="entry-footer">
<?php bfablog_entry_footer(); ?>
</footer><!-- .entry-footer -->
</article><!-- #post-## -->
<hr>
<script type="text/javascript">
var addthis_config = {
ui_language: "{{ site.lang }}"
};
var addthis_share =
{
// ... members go here
}
</script>
<!-- Go to www.addthis.com/dashboard to customize your tools -->
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-586c401922d76d24"></script>
Here is the code for content-page.php
<?php
/**
* Template part for displaying page content in page.php
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package BfA_Blog
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header><!-- .entry-header -->
<div class="entry-content"><hr>
<?php
the_content();
wp_link_pages(array(
'before' => '<div class="page-links">' . esc_html__('Pages:','bfablog'),
'after' => '</div>',
) );
?>
</div><!-- .entry-content -->
<?php if ( get_edit_post_link() ) : ?>
<footer class="entry-footer">
<?php
edit_post_link(
sprintf(
/* translators: %s: Name of current post */
esc_html__( 'Edit %s', 'bfablog' ),
the_title( '<span class="screen-reader-text">"', '"</span>', false )
),
'<span class="edit-link">',
'</span>'
);
?>
</footer><!-- .entry-footer -->
<?php endif; ?>
</article><!-- #post-## -->
bitly
links, I removed it from the post as the question can be explained even without it. If you think it's required please add the site URL not the bitly one