Category + tag page to grid

Hi there,

Clicking on a tag (or category) brings you to a page with minimal layout. Is it possible to refer them to a category in Essential Grid?

To: https://www.tekst2.nl/blog/#schrijftips
Instead of: https://www.tekst2.nl/category/schrijftips/

Chris

Hello Chris,

Thank you for the details.

Yes, you can display the post items in the category or tag archive page. You can do that by going to X > Theme Options > Blog > Archives and make sure to set the style to “Masonry”.

Hope this helps. Please let us know how it goes.

It looks better, but it is not really what I want to achieve. If they click on a tag, they must go directly to the grid on that page with the tag selected. I came across the following, I don’t know if I’m in the right direction then? https://www.themepunch.com/faq/auto-populate-grid-for-archive-pages/ hopefully you can help me further.

Another question, I want to display a Global block after the featured image on a blog page, which hook should I use for this? (If that is not possible, above the featured image)

add_action( "HOOK?", "add_post_shortcode_blog" );
function add_post_shortcode_blog() {
	if(is_singular( 'post' )){
		echo do_shortcode( '[cs_gb id=1501]' );
	}
}

Hello @MooiInMaatwerk,

Thanks for updating in!

For your global block, you can update the code into this:

add_action( "x_before_view_integrity__content_post-header", "add_post_shortcode_blog" );
function add_post_shortcode_blog() {
	if(is_singular( 'post' )){
		echo do_shortcode( '[cs_gb id=1501]' );
	}
}

And yes the article from ThemPuunch should be able to help you achieve what you have in mind. Regretfully we can only point you in the right direction since custom development is beyond the scope of our support.

Please note that custom coding is outside the scope of our support. Issues that might arise from the use of custom code and further enhancements should be directed to a third party developer.

Best Regards.

Hello @RueNel,

Unfortunately that is out of scope for my knowledge, but will give it a try :slight_smile:

The given hook does not work, is another option possible?

Hey Chris,

Do you mean you want to add the global block on the blog/category/archive pages? If so, try using:


add_action( 'x_before_view_integrity__content_post-header', 'add_post_shortcode_blog' );
function add_post_shortcode_blog() {
	if(is_archive()){
		echo do_shortcode( '[cs_gb id=1501]' );
	}
}

Hope this helps.

Hello @Jade,

Thanks for your reply, unfortunately the code is not working. On the archive page.
What i want to achieve is that the global block is visible above the blog post.

Hello @MooiInMaatwerk,

Sorry if the code did not work. It is not using the correct action hook.
Have it updated and use this instead:

add_action( 'x_before_view_global__index', 'add_post_shortcode_blog' );
function add_post_shortcode_blog() {
	if(is_archive()){
		echo do_shortcode( '[cs_gb id=1501]' );
	}
}

Hope this helps. Kindly let us know.

Hello @RueNel,

On the archive page it is working, how to achieve this to the single blog post?

Hi Van,

For both archive page and single posts, you can use this code instead:

add_action( 'x_before_the_content_begin', 'add_post_shortcode_blog' );
add_action( 'x_before_view_global__index', 'add_post_shortcode_blog' );
function add_post_shortcode_blog() {
	if(is_archive() || is_singular( 'post' )){
		echo do_shortcode( '[cs_gb id=1501]' );
	}
}

To see all the actions and filters, please see https://theme.co/apex/forum/t/customizations-actions-and-filters-in-x-pro/208

Hope this helps!

Works like a charm :ok_hand:
Thanks for sharing the link, I couldn’t find anything about it in the KB.

We are delighted to assist you with this.

Cheers!

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