Is it possible to link to other static pages in a Timber template?Link to custom php theme page in wordpressReference - What does this error mean in PHP?home_url() links in wordpress site is getting redirected to some other urlLinks are redirecting to other pages after wordpress upgrade to 4.2.1Timber hash link filter on menu linksShow related post link titleTimber/WooCommerce 3.3.x issue?Uncaught Error: Class 'Timber' not foundUsing Timber to render 3rd party plugin page templatesTimber get_theme_mod in template
What speaks against investing in precious metals?
Implement Own Vector Class in C++
Fixing obscure 8080 emulator bug?
Need feedback - Can the composition/colors of this design be fixed if something is lacking or is not a better fit?
How to manually rewind film?
Meaning of 'lose their grip on the groins of their followers'
How come the nude protesters were not arrested?
Determining the price of an option when it hasn't been traded recently
Why didn't Voldemort recognize that Dumbledore was affected by his curse?
Does a scale have more than seven chords?
How to use memset in c++?
How does an ordinary object become radioactive?
Why can't I use =default for default ctors with a member initializer list
How do I prevent employees from either switching to competitors or opening their own business?
Russian word for a male zebra
Mathematically, why does mass matrix / load vector lumping work?
How to hide an urban landmark?
Rebus with 20 song titles
How to trick the reader into thinking they're following a redshirt instead of the protagonist?
Why can my keyboard only digest 6 keypresses at a time?
How to handle self harm scars on the arm in work environment?
How is water heavier than petrol, even though its molecular weight is less than petrol?
Alternate way of computing the probability of being dealt a 13 card hand with 3 kings given that you have been dealt 2 kings
Is it legal for a bar bouncer to confiscate a fake ID
Is it possible to link to other static pages in a Timber template?
Link to custom php theme page in wordpressReference - What does this error mean in PHP?home_url() links in wordpress site is getting redirected to some other urlLinks are redirecting to other pages after wordpress upgrade to 4.2.1Timber hash link filter on menu linksShow related post link titleTimber/WooCommerce 3.3.x issue?Uncaught Error: Class 'Timber' not foundUsing Timber to render 3rd party plugin page templatesTimber get_theme_mod in template
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
Currently, to link to a "FAQ" page, I have the following:
Check out our <a href=" site.link /faq">FAQ</a> page.
However, I'd like to be able to link to other internal pages in my WordPress theme without manually writing in the URL parameters after it. Something like:
Check out our <a href=" site.link('faq') ">FAQ</a> page.
Is this not possible in Timber? I've checked through the docs but don't see any references to it, but I feel like I must be missing something.
php wordpress twig wordpress-theming timber
add a comment |
Currently, to link to a "FAQ" page, I have the following:
Check out our <a href=" site.link /faq">FAQ</a> page.
However, I'd like to be able to link to other internal pages in my WordPress theme without manually writing in the URL parameters after it. Something like:
Check out our <a href=" site.link('faq') ">FAQ</a> page.
Is this not possible in Timber? I've checked through the docs but don't see any references to it, but I feel like I must be missing something.
php wordpress twig wordpress-theming timber
add a comment |
Currently, to link to a "FAQ" page, I have the following:
Check out our <a href=" site.link /faq">FAQ</a> page.
However, I'd like to be able to link to other internal pages in my WordPress theme without manually writing in the URL parameters after it. Something like:
Check out our <a href=" site.link('faq') ">FAQ</a> page.
Is this not possible in Timber? I've checked through the docs but don't see any references to it, but I feel like I must be missing something.
php wordpress twig wordpress-theming timber
Currently, to link to a "FAQ" page, I have the following:
Check out our <a href=" site.link /faq">FAQ</a> page.
However, I'd like to be able to link to other internal pages in my WordPress theme without manually writing in the URL parameters after it. Something like:
Check out our <a href=" site.link('faq') ">FAQ</a> page.
Is this not possible in Timber? I've checked through the docs but don't see any references to it, but I feel like I must be missing something.
php wordpress twig wordpress-theming timber
php wordpress twig wordpress-theming timber
asked Mar 24 at 18:10
OneMohrTimeOneMohrTime
597
597
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You can add the pages into your context using the filter timber_context
add_filter('timber_context', 'add_to_context');
function add_to_context($context)
/* this is where you can add your own data to Timber's context object */
$extraLinks = [];
$extraLinks['faq'] = get_permalink($faq_ID);
$context['site']['extraLinks'] = $extraLinks;
return $context;
So you can call in your twig file
Check out our <a href=" site.extraLinks.faq ">FAQ</a> page.
source
Not entirely the way I assumed, but definitely a good resolution. I may just turn this into anarray()
for common top-level pages...
– OneMohrTime
Mar 26 at 18:30
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
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%2fstackoverflow.com%2fquestions%2f55326909%2fis-it-possible-to-link-to-other-static-pages-in-a-timber-template%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can add the pages into your context using the filter timber_context
add_filter('timber_context', 'add_to_context');
function add_to_context($context)
/* this is where you can add your own data to Timber's context object */
$extraLinks = [];
$extraLinks['faq'] = get_permalink($faq_ID);
$context['site']['extraLinks'] = $extraLinks;
return $context;
So you can call in your twig file
Check out our <a href=" site.extraLinks.faq ">FAQ</a> page.
source
Not entirely the way I assumed, but definitely a good resolution. I may just turn this into anarray()
for common top-level pages...
– OneMohrTime
Mar 26 at 18:30
add a comment |
You can add the pages into your context using the filter timber_context
add_filter('timber_context', 'add_to_context');
function add_to_context($context)
/* this is where you can add your own data to Timber's context object */
$extraLinks = [];
$extraLinks['faq'] = get_permalink($faq_ID);
$context['site']['extraLinks'] = $extraLinks;
return $context;
So you can call in your twig file
Check out our <a href=" site.extraLinks.faq ">FAQ</a> page.
source
Not entirely the way I assumed, but definitely a good resolution. I may just turn this into anarray()
for common top-level pages...
– OneMohrTime
Mar 26 at 18:30
add a comment |
You can add the pages into your context using the filter timber_context
add_filter('timber_context', 'add_to_context');
function add_to_context($context)
/* this is where you can add your own data to Timber's context object */
$extraLinks = [];
$extraLinks['faq'] = get_permalink($faq_ID);
$context['site']['extraLinks'] = $extraLinks;
return $context;
So you can call in your twig file
Check out our <a href=" site.extraLinks.faq ">FAQ</a> page.
source
You can add the pages into your context using the filter timber_context
add_filter('timber_context', 'add_to_context');
function add_to_context($context)
/* this is where you can add your own data to Timber's context object */
$extraLinks = [];
$extraLinks['faq'] = get_permalink($faq_ID);
$context['site']['extraLinks'] = $extraLinks;
return $context;
So you can call in your twig file
Check out our <a href=" site.extraLinks.faq ">FAQ</a> page.
source
answered Mar 25 at 20:26
Lincoln LemosLincoln Lemos
984
984
Not entirely the way I assumed, but definitely a good resolution. I may just turn this into anarray()
for common top-level pages...
– OneMohrTime
Mar 26 at 18:30
add a comment |
Not entirely the way I assumed, but definitely a good resolution. I may just turn this into anarray()
for common top-level pages...
– OneMohrTime
Mar 26 at 18:30
Not entirely the way I assumed, but definitely a good resolution. I may just turn this into an
array()
for common top-level pages...– OneMohrTime
Mar 26 at 18:30
Not entirely the way I assumed, but definitely a good resolution. I may just turn this into an
array()
for common top-level pages...– OneMohrTime
Mar 26 at 18:30
add a comment |
Thanks for contributing an answer to Stack Overflow!
- 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%2fstackoverflow.com%2fquestions%2f55326909%2fis-it-possible-to-link-to-other-static-pages-in-a-timber-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