Ethos - Insert section between Post Slider and Blog Index

HI,

I have purchased X-Theme Ethos,

I am currently trying to add an intro section in-between the Post Slider and the Blog Index of the main page.

Intro section would include a 1/3, 2/3 image and paragraph content respectively.

Please advise.

Sidenote: I found a similar topic post requesting how to add content above posts on Blog page.


Helpful Staff provided a JS solution response as a fix as follows. .

jQuery( ".blog .x-main .x-container" ).before( "<p>This is my content</p>" );

This did not work for me.

Thanks,
Al

Hi Vargie,

You have to setup a child theme first:

After that add the following code under functions.php file locates in your child theme:

add_action( 'x_before_view_global__index', 'print_custom_header_for_blog' );
function print_custom_header_for_blog(){
	if( is_home() ){
		?>
		<div id="blog_section" class="x-section" style="margin: 0px;padding: 45px 0px; background-color: transparent;">
			<div class="x-container max width" style="margin: 0px auto;padding: 0px;">
				<div class="x-column x-sm x-1-3" style="padding: 0px;">
					<img src="https://via.placeholder.com/500x300">
				</div>
				<div class="x-column x-sm x-2-3" style="padding: 0px;">
					<p>Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, <a href="#">sometimes</a> on purpose (injected humour and the like).</p>
				</div>
			</div>
		</div>
		<?php
	}
}

Hope it helps :slight_smile:

Dear Thai,

Thank you very much, your advice and your code worked great.

Child Class installation was a piece of cake and the code was spot on.

Very Much Appreciated,
Vargie

You’re most welcome Vargie!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.