I'm writing a plugin that creates a custom post type named "my_plugin_lesson":
$args = array ( 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => 'lessons', 'with_front' => false) ); register_post_type ('my_plugin_lesson', $args);
The custom post type has an archive, and the URL of the archive is:
I want to customize the look of this archive; I want to list the posts in a table format, rather than the standard WordPress blog post archive. I understand that a custom archive template could be created in the theme by making the
archive-my_plugin_lesson.php file; however, I would like the plugin to work with any theme.
How can I alter the content of the archive page without adding or modifying theme files?
I understand that I could use the
archive_template filter hook. However, all this does is replace the theme template, which still needs to be theme-specific. For example, just about every theme template will need the
get_footer functions, but what should the id of the content
<div> be? This is different in every theme.
What I would like to do is to replace the content itself with my own content, and use that in place of the archive page for my custom post type.