Help Removing Old Code from Child-Theme

Hey there, 10 years ago I’ve asked for some coding to use The Grid plugin to show my Blog Posts. Now 10 years later that plugin doesn’t exist and I’m trying to spin a new site without it but my Child-Theme still have many options on globals/_index.hp file:

<?php

// =============================================================================
// VIEWS/GLOBAL/_INDEX.PHP
// -----------------------------------------------------------------------------
// Includes the index output.
// =============================================================================

$stack = x_get_stack();

if ( is_home() ) :
  $style     = x_get_option( 'x_blog_style' );
  $cols      = x_get_option( 'x_blog_masonry_columns' );
  $condition = is_home() && $style == 'masonry';
elseif ( is_archive() ) :
  $style     = x_get_option( 'x_archive_style' );
  $cols      = x_get_option( 'x_archive_masonry_columns' );
  $condition = is_archive() && $style == 'masonry';
elseif ( is_search() ) :
  $condition = false;
endif;

?>

<?php

if ( $condition ) {

	x_get_view( 'global', '_script', 'isotope-index' );

	?>

	<div id="x-iso-container" class="x-iso-container x-iso-container-posts cols-<?php echo $cols; ?>">

    <?php

	if (have_posts()) {

		if (is_home() || is_front_page() || is_archive()) {

			The_Grid('blog', true);

		} else {

			while (have_posts()) {
				the_post();
				if ( $stack != 'ethos' ) {
					x_get_view( $stack, 'content', get_post_format() );
				} else {
					x_ethos_entry_cover( 'main-content' );
				}
			}

		}

	} else {

	  	x_get_view( 'global', '_content-none' );

	}

	?>
	</div>
	<?php

} else {

	if ( have_posts() ) {

		if (is_home() || is_front_page() || is_archive()) {

			//The_Grid('blog', true);

		} else {

			while (have_posts()) {
				the_post();
				x_get_view( $stack, 'content', get_post_format() );
			}
		}

	} else {

    	x_get_view( 'global', '_content-none' );

	}

}

if (!is_home() && !is_front_page() && !is_archive()) {
	pagenavi();
}

?>

The question: should I remove just The Grid line, or can I delete the whole _index.php file?

I will not use The Grid on this site, and my coding level is too low to know if I should keep the other codes on that page, what to remove in order to get rid of The Grid for good.

I thank you very much if some of you can explain me what was written on that page, so to know what to remove or if I need to remove the whole page itself.

I’ll keep looking forward from you on that, thank you so much! Cheers!

Hi @fabiofava,

Thanks for reaching out.

It’s very difficult to provide guidance on custom coding, as that falls outside the scope of Theme Support. If your code is quite outdated, I recommend creating a new Child Theme and applying the customizations one by one. This way, if anything breaks, you can easily identify and fix the issue step-by-step.

If you still need help, I would suggest you hire a developer who can assist you to do the customization, or you can avail of our newly launched service called One, where we answer the questions beyond normal theme support.

Note: Before modifying your child theme or any code, please make sure to take a full backup. This ensures you can restore your site if anything goes wrong.

Thanks

Hey @tristup thanks for getting back!

I’ve done a good sanitization on the functions.php of the chilid theme, so I know what is there and what it serves to. On the case of /globals/_index.php it was a code provided by the ThemeCo support 10 years ago.

Since my coding is worse than poor, I’d like just some descriptors for each “section” of the coding on this /globals/_index.php file, so I can better know what to remove or not. I just kindly ask to add some lines with those descriptors.

I know it’s boring (but impossible for my null-level on coding) but I assume one who know what he/she is doing, would do that in less than 5 minutes. I will never be able to discover by myself what every part of it is for.

I hope some good soul can help me on that, knowing what it’s for, I can decide what to keep. I hope you understand my suffering here, and that you or some other brother could help me to go ahead building the site.

Thank you very much for everything (since 2015), really. You folks rock. This site I’m building now is the one to catch clients to be able to hire the full Support Service.

Cheers

Hello @fabiofava,

Thank you for the update.

You can probably delete the whole global/_index.php file since the plugin that it was intended for no longer exists, assuming there are no template redirects or modifications added to the site. Once deleted, it should default to \framework\views\global_index.php.

!!IMPORTANT!!: Make sure to create a site backup or restore point before attempting to delete the file.

Let us know the result.

Best regards,

Hey @Ismael thank you for getting back!

So that _index.php was all to make my blog page to display a grid from The Grid plugin.

What would be your ( you and the ThemeCo Devs in general) recommendation to replicate the effect of that blog using native CS elements? The page below uses The Grid and that /globals/_index.php to show a The Grid grid element to show my posts.

https://fabiofava.org/logbook/

I’d like to have somethint alike but I’m tired of no more updates or support or development from The Grid Devs. Their new product don’t import The Grid exports, it’s a paid update every once in a while, and they have not a real support; so I’d rather have something made “in the house” with Cornerstone.

I’ll keep looking forward from you on a solution to show my Blog as a Grid.

Thank you so much for all the information , cheers brother!

Hey @fabiofava,

The alternative to The Grid plugin would be the Essential Grid plugin. You can learn more about the Essential Grid here https://theme.co/docs/essential-grid

Thank yo @christian for getting back!

I thought it was possible to create a grid and populate it with my posts using Cornerstone, without the need of one more plugin. As this site will be WPML’d I’d need to keep the plugins amout as less as possible… Would that be possible or only via plugin?

Thank you again for the infos, cheers!

Hi @fabiofava,

Instead of customizing the code, you might want to try using the Grid Element, which could help you achieve the layout you’re aiming for.
I recommend creating a new page and adding the Grid Element to test your layout. If it works well, you can remove the custom file and continue using the new page. Please refer to the following documentation for more details on the Grid Element.

Hope it helps.
Thanks

Hey @tristup thank you for the infos!

I’ll check it out and start learning it.

I’ll consider this ticket closed, thanks!

Hi @fabiofava,

You are most welcome. Please let ue know if you need any further help with this.