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

littlefoot.js and wordpress #8

Closed
kadso opened this issue Aug 20, 2018 · 7 comments
Closed

littlefoot.js and wordpress #8

kadso opened this issue Aug 20, 2018 · 7 comments
Labels

Comments

@kadso
Copy link

kadso commented Aug 20, 2018

I presently use bigfoot.js extensively in my wordpress site (www.agneic.com)

I am designing new website and thinking of using little foot.js.

Do you know of anyone/anywhere I might reference how to install littlefoot.js in a wordpress environment?

being really new to coding, I'm presently unsure of what goes where when it comes to installing littlefoot.js into a word press environment...

@goblindegook
Copy link
Owner

If the HTML is built in a way littlefoot expects it (check the README for an example), even pulling its files from a CDN should work:

Be sure to call littlefoot() somewhere in your JavaScript code to initialize it.

There are other, more efficient ways to integrate littlefoot into WordPress, but it depends on your asset bundling strategy, so I can't help you further.

@goblindegook
Copy link
Owner

I've set up a simple demo on Codepen that you can follow as reference for your generated page. Hope this helps.

@goblindegook
Copy link
Owner

goblindegook commented Aug 20, 2018

I haven't tested it, but adding the following to your theme's functions.php file should work:

function littlefoot() {
  wp_enqueue_style( 'littlefoot-style', 'https://unpkg.com/littlefoot@1.0.5/dist/littlefoot.css', array(),  '1.0.5' );
  wp_enqueue_script( 'littlefoot-script', 'https://unpkg.com/littlefoot@1.0.5/dist/littlefoot.min.js', array(), '1.0.5', true );
  wp_add_inline_script( 'littlefoot-script', 'littlefoot.default()' );
}

add_action( 'wp_enqueue_scripts', 'littlefoot' );

Please correct me if this doesn't work. Just make sure the HTML conforms to the examples provided in the README.

@kadso
Copy link
Author

kadso commented Aug 20, 2018 via email

@goblindegook
Copy link
Owner

If Bigfoot works with your current HTML, littlefoot should too and you definitely do not need to change the document structure. I'm assuming this is an issue with either including the littlefoot script in your page or executing the main function to set it all up.

I haven't touched WordPress in a long time, and my only experience integrating the two was through a custom build setup, so I'm not sure how I can help you. Maybe other WordPress users can be of assistance?

@goblindegook
Copy link
Owner

The sample code I provided above is very likely not right, but I don't have a WordPress instance handy to test it out, I'm afraid.

@kadso
Copy link
Author

kadso commented Aug 30, 2018 via email

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