Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arguments from index.php on antoher sites ex: front-page #1424

Closed
kuba-leman opened this issue May 19, 2017 · 4 comments
Closed

arguments from index.php on antoher sites ex: front-page #1424

kuba-leman opened this issue May 19, 2017 · 4 comments

Comments

@kuba-leman
Copy link

kuba-leman commented May 19, 2017

hi! i have big problem with arguments on my site.
i made this on my index.php

$twigcontent['header_widget_1'] = Timber::get_widgets('header-widget-1');
$twigcontent['header_widget_2'] = Timber::get_widgets('header-widget-2');
$twigcontent['header_widget_3'] = Timber::get_widgets('header-widget-3');

my problem is with range

problem is : i cant use them on front-page.
but i using block like this:

    {% extends "index.twig" %}

    {% block main %}
     //front page content
    {% endblock %}

what can i do in this situation?

@kuba-leman
Copy link
Author

kuba-leman commented May 22, 2017

someone?

@gchtr
Copy link
Member

gchtr commented May 22, 2017

Hey @lupik2

Next time it would be better to ask a question like this in the Gitter chat or on Stackoverflow, tagged with timber. You normally get a quicker answer 😊.

Could you give us some more information?

  • What do you mean with: My problem is with range?
  • What do you want to do exactly? Do you want to display your widgets on the front page?
  • Can you show us how your complete index.php looks like?
  • Which version of Timber are you using?

@kuba-leman
Copy link
Author

kuba-leman commented May 22, 2017

my index.php : http://wklej.org/hash/eeab46a2547/

in index.twig i made for loop to write styles and on index page everything is fine but for example in post page styles doesnt work, single.twig:

 {% extends "index.twig" %}

    {% block main %}
     //post content
    {% endblock %}

@corygibbons
Copy link

@lupik2 It's likely because you have a single.php, front-page.php, or similar file that's taking priority over your index.php (template hierarchy docs).

index.twig rendering does not necessarily mean that it went through index.php.

For conditionally loading scripts/style you should look into wp_enqueue_style()(docs) and wp_enqueue_script()(docs)

@nlemoine nlemoine closed this as completed Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants