How do I create a custom partial / template?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty{ margin-bottom:0;
}
up vote
1
down vote
favorite
I have created an sign up form and placed it in my header:
<div>
<h5 class="myapp-sign-up-text">Sign up for updates</h5>
<form class="myapp-email-form">
<input type="text" name="email" placeholder="Your email address" class="myapp-subscription-input" />
<input type="submit" value="Subscribe" class="myapp-subscription-submit" />
</form>
</div>
I would like to use the same code for my footer. Is there a DRY way of putting this into a partial and loading it using a PHP function?
theme-development templates
add a comment |
up vote
1
down vote
favorite
I have created an sign up form and placed it in my header:
<div>
<h5 class="myapp-sign-up-text">Sign up for updates</h5>
<form class="myapp-email-form">
<input type="text" name="email" placeholder="Your email address" class="myapp-subscription-input" />
<input type="submit" value="Subscribe" class="myapp-subscription-submit" />
</form>
</div>
I would like to use the same code for my footer. Is there a DRY way of putting this into a partial and loading it using a PHP function?
theme-development templates
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have created an sign up form and placed it in my header:
<div>
<h5 class="myapp-sign-up-text">Sign up for updates</h5>
<form class="myapp-email-form">
<input type="text" name="email" placeholder="Your email address" class="myapp-subscription-input" />
<input type="submit" value="Subscribe" class="myapp-subscription-submit" />
</form>
</div>
I would like to use the same code for my footer. Is there a DRY way of putting this into a partial and loading it using a PHP function?
theme-development templates
I have created an sign up form and placed it in my header:
<div>
<h5 class="myapp-sign-up-text">Sign up for updates</h5>
<form class="myapp-email-form">
<input type="text" name="email" placeholder="Your email address" class="myapp-subscription-input" />
<input type="submit" value="Subscribe" class="myapp-subscription-submit" />
</form>
</div>
I would like to use the same code for my footer. Is there a DRY way of putting this into a partial and loading it using a PHP function?
theme-development templates
theme-development templates
edited 5 hours ago
Krzysiek Dróżdż
13k52739
13k52739
asked 5 hours ago
Edmund
201312
201312
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
2
down vote
accepted
The thing you're searching for is get_template_part
function.
So let's say you put your form in file called part-form-signup.php
. Then you can easily include that partial template anywhere using:
get_template_part( 'part-form-signup' );
add a comment |
up vote
1
down vote
Checkout get_template_part(). Also, here is a good read on the topic.
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
The thing you're searching for is get_template_part
function.
So let's say you put your form in file called part-form-signup.php
. Then you can easily include that partial template anywhere using:
get_template_part( 'part-form-signup' );
add a comment |
up vote
2
down vote
accepted
The thing you're searching for is get_template_part
function.
So let's say you put your form in file called part-form-signup.php
. Then you can easily include that partial template anywhere using:
get_template_part( 'part-form-signup' );
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
The thing you're searching for is get_template_part
function.
So let's say you put your form in file called part-form-signup.php
. Then you can easily include that partial template anywhere using:
get_template_part( 'part-form-signup' );
The thing you're searching for is get_template_part
function.
So let's say you put your form in file called part-form-signup.php
. Then you can easily include that partial template anywhere using:
get_template_part( 'part-form-signup' );
answered 5 hours ago
Krzysiek Dróżdż
13k52739
13k52739
add a comment |
add a comment |
up vote
1
down vote
Checkout get_template_part(). Also, here is a good read on the topic.
add a comment |
up vote
1
down vote
Checkout get_template_part(). Also, here is a good read on the topic.
add a comment |
up vote
1
down vote
up vote
1
down vote
Checkout get_template_part(). Also, here is a good read on the topic.
Checkout get_template_part(). Also, here is a good read on the topic.
answered 5 hours ago
RiddleMeThis
579313
579313
add a comment |
add a comment |
Thanks for contributing an answer to WordPress Development Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fwordpress.stackexchange.com%2fquestions%2f321136%2fhow-do-i-create-a-custom-partial-template%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown