Answers.Body: <p>I would think that you could hook into one of the template render events like:</p>
  <ul>
  <li>craft\web\View::EVENT_BEFORE_RENDER</li>
  <li>craft\web\View::EVENT_BEFORE_RENDER_TEMPLATE</li>
  <li>craft\web\View::EVENT_BEFORE_RENDER_PAGE_TEMPLATE</li>
  </ul>
  <p>Alternatively, you might want to check out the source code for the KnockKnock plugin, which intercepts page loads to present a custom password screen instead of the page being requested.</p>
  <p><a href="https://github.com/verbb/knock-knock/blob/craft-3/src/KnockKnock.php#L67" rel="nofollow noreferrer">https://github.com/verbb/knock-knock/blob/craft-3/src/KnockKnock.php#L67</a></p>
  <p>One of those should point you in the right direction.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-05T21:57:05.707Z
Answers.LastActivityDate: 2022-01-05T21:57:05.707Z
Answers.UserDisplayName: stevecomrie
Body: <p>I am trying to create a plugin if the user enables plugin settings then it will replace the homepage of the website with my custom designed template</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-01-05T22:28:35.657Z
Comments.Text: Hi DotSquares! You’ve posted several questions that don’t provide much context about what you’re looking to do or what you’ve tried. Please make sure [you’re asking thoughtful, specific questions](https://craftcms.stackexchange.com/help/how-to-ask) to increase your odds of getting good answers and helping others that come across your posts later.
  
  If someone takes the time to post an answer that solves your problem, please consider accepting that answer as well.
Comments.UserDisplayName: Matt Stein
Tags: <plugin-development><templating><plugins><twigextension>
Title: how to create a custom plugin if the user enables plugin settings then it will replace the website home page to my custom design?
ThreadText: # how to create a custom plugin if the user enables plugin settings then it will replace the website home page to my custom design?
  
  (Asked by: username_0 on 2022-01-05)
  
  I am trying to create a plugin if the user enables plugin settings then it will replace the homepage of the website with my custom designed template
  
  **Tags:** plugin-development, templating, plugins, twigextension
  
  > **Comments:**
  > **username_1**: Hi DotSquares! You’ve posted several questions that don’t provide much context about what you’re looking to do or what you’ve tried. Please make sure [you’re asking thoughtful, specific questions](https://craftcms.stackexchange.com/help/how-to-ask) to increase your odds of getting good answers and helping others that come across your posts later.  If someone takes the time to post an answer that solves your problem, please consider accepting that answer as well.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2022-01-05. Score: 3
  
  I would think that you could hook into one of the template render events like:
  
  * craft\web\View::EVENT\_BEFORE\_RENDER
  * craft\web\View::EVENT\_BEFORE\_RENDER\_TEMPLATE
  * craft\web\View::EVENT\_BEFORE\_RENDER\_PAGE\_TEMPLATE
  
  Alternatively, you might want to check out the source code for the KnockKnock plugin, which intercepts page loads to present a custom password screen instead of the page being requested.
  
  <https://github.com/verbb/knock-knock/blob/craft-3/src/KnockKnock.php#L67>
  
  One of those should point you in the right direction.
  
  
  ---
  
  