How to make a custom page template plugin
-
Hello all, I have made a custom page template and would like to put it in a plugin. I have read several articles over several days on how to do this but none make sense to me.
Here is the code I would like to put in a plugin:
<?php /** /* * Template Name: Home Page * Description: Home Page */ get_header(); ?> <div id="primary" <?php generate_content_class();?>> <main id="main" <?php generate_main_class(); ?>> <?php do_action('generate_before_main_content'); ?> <?php while ( have_posts() ) : the_post(); ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_article_schema( 'CreativeWork' ); ?>> <div class="inside-article"> <?php do_action( 'generate_before_content'); ?> <?php if ( generate_show_title() ) : ?> <header class="entry-header"> <?php the_title( '<h1 class="entry-title" itemprop="headline">', '</h1>' ); ?> </header><!-- .entry-header --> <?php endif; ?> <?php do_action( 'generate_after_entry_header'); ?> <div class="entry-content" itemprop="text"> <?php the_content(); ?> <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ), 'after' => '</div>', ) ); ?> <!-- My stuff start--> My extraordinary content <!-- My stuff end--> </div><!-- .entry-content --> <?php do_action( 'generate_after_content'); ?> </div><!-- .inside-article --> </article><!-- #post-## --> <?php // If comments are open or we have at least one comment, load up the comment template if ( comments_open() || '0' != get_comments_number() ) : ?> <div class="comments-area"> <?php comments_template(); ?> </div> <?php endif; ?> <?php endwhile; // end of the loop. ?> <?php do_action('generate_after_main_content'); ?> </main><!-- #main --> </div><!-- #primary --> <?php do_action('generate_sidebars'); get_footer();
- The topic ‘How to make a custom page template plugin’ is closed to new replies.