Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logic to swap out category archive with designated page #2

Open
cparkinson opened this issue Nov 14, 2023 · 1 comment · May be fixed by #3
Open

logic to swap out category archive with designated page #2

cparkinson opened this issue Nov 14, 2023 · 1 comment · May be fixed by #3

Comments

@cparkinson
Copy link

cparkinson commented Nov 14, 2023

Right now, the plugin sets the page for category archives, but doesn't do anything. The logic to swap out the default generated archive for the page set in Archive Pages is in lightship-main/category.php

Ideally the plugin would do something to category archives. Right now it saves the page settings then does nothing.

https://app.asana.com/0/1202723358174594/1205711392505481/f

$archive_page_id = get_option('archive_page_' . $cat_slug );
if ( $archive_page_id ){
	//if Set Archives field is set, call page template
	$context['post'] = Timber::get_post( $archive_page_id );

	Timber::render( array( 'page-' . $context['post']->post_name . '.twig', 'page.twig' ), $context );
}else{
	//call default archive template
	Timber::render(array( 'archive.twig', 'index.twig' ), $context);
}
@cparkinson
Copy link
Author

I have this set up on my local in a different branch. I think I pushed it here - will create pull request.

@cparkinson cparkinson linked a pull request Nov 15, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant