php – how to override html code in wordpress?

<article id="post-<?php the_ID(); ?>" <?php post_class( array('list-article', 'clearfix') ); ?>>

<div class="list-article-thumb">
    <a href="https://wordpress.stackexchange.com/questions/306742/<?php echo esc_url( get_permalink() ); ?>">
        <?php
        if ( has_post_thumbnail( ) ) {
            the_post_thumbnail( 'onepress-blog-small' );
        } else {
            echo '<img alt="" src="'. get_template_directory_uri() . '/assets/images/placholder2.png' .'">';
        }
        ?>
    </a>
</div>

<div class="list-article-content">
    <div class="list-article-meta">
        <?php the_category("https://wordpress.stackexchange.com/"); ?>
    </div>
    <header class="entry-header">
        <?php the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>
    </header><!-- .entry-header -->
    <div class="entry-excerpt">
        <?php
            the_excerpt();
        ?>
        <?php
            wp_link_pages( array(
                'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'onepress' ),
                'after'  => '</div>',
            ) );
        ?>
    </div><!-- .entry-content -->
</div>

This is the code.

I need to override all code inside

<div class="list-article-content">
</div>

Because HTML codes are not surrounded by if(!functionname()){}

I don’t know how to override this code.

I tried copying and pasting it into functions.php in the child theme, but it just duplicated the html code.

So, how to override this HTML code on child theme without editing parent theme?

Leave a Comment