Changing order title and featured image in blog post (Astra theme)

Question

The HTML of a post type, I want to swap the position of the title and the thumbnail. I noticed that the title and thumbnail are inside a <header> tag. So I went looking which template file has this markup, applied to the post type ‘post’

So instead of this

<header class="entry-header ast-no-meta">
    <div class="post-thumb-img-content post-thumb"></div>
    <div class="ast-single-post-order"></div>
</header>

I want this

<header class="entry-header ast-no-meta">
    <div class="ast-single-post-order"></div>
    <div class="post-thumb-img-content post-thumb"></div>
</header>

I have found this code in the template file that applies to pages: /template-parts/content-page.php

This file has

<header class="entry-header <?php astra_entry_header_class();?>">

        <?php astra_get_post_thumbnail();?>

        <?php
astra_the_title(
    '<h1 class="entry-title" ' . astra_attr(
        'article-title-content-page',
        array(
            'class' => '',
        )
    ) . '>',
    '</h1>'
);
?>
    </header><!-- .entry-header -->

This looks great, I could just override this template file in my child theme and put astra_get_post_thumbnail() below

However, template files that apply to posts of the the type ‘post’ have code that gets me lost in the functions calling functions trail that I don’t know how to follow anymore.

However, one file that seems like a good candidate is blog.php in the astra/inc folder.

This file seems to have code that looks like I can work with it.

Like the function astra_blog_post_thumbnail_and_title_order() The function name seems to imply that it’s the one to get called to actually determine the order of the title and featured image. But this function then seems to call functions of which how to work with them is starting to elude me, like image_before_ Which of course I could look op and eventually find out which HTML that in turn will output, but then how do you put that into one piece of logic. And are you supposed to?

I tried to override astra/inc/blog/blog.php and put a copy of it in astra-child/inc/blog/blog.php and put a die(); function in front of everything. But it doesn’t seem to be doing anything. Cleared caches, refreshed many times. And triple checked the file name and made sure I copied the folder hierarchy into the child theme.

0
Immers 2 months 0 Answers 10 views 0

Leave an answer