How to add element (cornerstone) in homepage

Hi,

Im using ethos on my current x theme. I understand that the layout of ehtos is fixed, but i want to add element, something like 3 column images under the slider (Rev Slider) on my homepage.

I understand this could be achieve by setting the home page to display specific page. Then edit the page with cornerstone. The problem is my website is a blog, need to display 10-15 title + image + description (with pagination).

Is it possible to design the three column images on the cornerstone and later call the short code (or what ever) on php loop? (i’m using latest post for homepage).

If that not possible, then how can I create the post loop (images, title, desc, date, author) with page one the cornerstone (also with pagination).

Sorry for the bad english.

Hi There,

You need to setup a child theme first: https://theme.co/apex/forum/t/setup-how-to-setup-child-themes/57.

After that add this custom code under functions.php file locates in your child theme:

add_action( 'x_after_view_global__slider-below', 'print_custom_html_ethos' );
function print_custom_html_ethos(){
	?>
	<section id="top_blog">
		<div class="x-container max width">
			<div class="x-column x-sm x-1-3" style="">
				<img src="http://via.placeholder.com/350x150">
			</div>
			<div class="x-column x-sm x-1-3" style="">
				<img src="http://via.placeholder.com/350x150">
			</div>
			<div class="x-column x-sm x-1-3 last" style="">
				<img src="http://via.placeholder.com/350x150">
			</div>
		</div>
	</section>
	<?php
}

Hope it helps :slight_smile:

Hi,

thank you for your reply. Yes I’m aware of that solution too, but i was hoping to use corner stone and later call the function/shortcode, is that possible? If using your solution i would have to change the code very often and doing css/coding. With cornerstoen i can use the front end and just call it.

Regrads

Hey Hendri,

That is possible using Global Blocks. To output a global block to a template, you need to use do_shortcode. Here’s a sample to be placed inside your function.

echo do_shortcode( '[cs_gb id=911]' );

Hope that helps.

Thank you, I’ll try this and check if it works.

Let us know the result!

Thanks

One last question! :slight_smile:

Please see this https://imgur.com/a/pjOs894

I want to insert my shortcode global block below the revolution slider, just before blog content and have a full width. Where is the best place to put the shortcode? Thanks

Hi There,

Please try with this code:

add_action( 'x_after_view_global__slider-below', 'print_custom_html_ethos' );
function print_custom_html_ethos(){
	echo do_shortcode( '[cs_gb id=911]' );
}

If it doesn’t work, please provide us with your website URL, admin account, password so we can take a closer look.

Regards!

Works like a charm. Thanks. This one is solved!

You’re most welcome!

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