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

Support PHP functions inside html tags #11

Open
janwirth opened this issue Jan 13, 2015 · 5 comments
Open

Support PHP functions inside html tags #11

janwirth opened this issue Jan 13, 2015 · 5 comments
Labels

Comments

@janwirth
Copy link
Collaborator

There is no way to do this:
http://codex.wordpress.org/Function_Reference/body_class

@ivankravchenko
Copy link
Member

definitely :)
On my WP themes, body_class is just not used.
How do you see body_class can be correctly called in jade?
I think, this particular case needs a workaround.
For example, using &attributes, body&attributes(bodyAttributes), where bodyAttributes is passed into template.

@janwirth
Copy link
Collaborator Author

what about =body_class() escaped and !=body_class() unescaped. Seems like the most logical succession to me.

or maybe
#{body_class()}

I'd like to try it out, but i barely have any brain juice left for today.

@ivankravchenko
Copy link
Member

Brain juice ;)
As for me, Jade have no direct equialent to <body <?php body_class() ?>> code.
Actually, one possible direct workaround is:

doctype html
html
  head
    title An ugly workaround with WP's body_class()
  | <body !{body_class()}>
  h1 Eh?
  | </body>

Supposably, my previous suggestion with &attributes is better.

@janwirth
Copy link
Collaborator Author

So if I am getting this right, a tag using this feature may look like this
a(href='#')&(phpFunction()).linkClass A link
as supposed to this
a(href='#' =phpFunction()).linkClass A link

@ivankravchenko
Copy link
Member

a(href='#' =phpFunction()).linkClass A link isn't correct Jade code.
a(href='#')&(phpFunction()).linkClass A link possible, but if phpFunction() return data in some special format. I think body_class() is not applicable here. I'll think about this.

P.S.: I am also using jade2php on WordPress templates, I need to share my work :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants