-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit cc95427
Showing
5 changed files
with
153 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "ed-itsolutions/wp-fontawesome", | ||
"description": "Simple easy to bundle font-awesome for WordPress", | ||
"require": { | ||
"php": "^5.3.3 || ^7.0", | ||
"fortawesome/font-awesome": "^5.15" | ||
}, | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Adam Laycock", | ||
"email": "[email protected]", | ||
"homepage": "https://www.arcath.net", | ||
"role": "Developer" | ||
} | ||
], | ||
"autoload": { | ||
"files": ["fontawesome.php"] | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
function wp_fontawesome_get_base_url(){ | ||
$base = get_template_directory_uri(); | ||
|
||
$parts = explode(get_template(), dirname(__FILE__)); | ||
|
||
$url = str_replace('\\', '/', $base . $parts[1]); | ||
|
||
return $url; | ||
} | ||
|
||
function wp_fontawesome_register_font_awesome(){ | ||
$basePath = apply_filters('wp_fontawesome_base_url', wp_fontawesome_get_base_url()); | ||
|
||
wp_register_script( | ||
'font-awesome', | ||
$basePath . '/vendor/fortawesome/font-awesome/js/all.js', | ||
array(), | ||
'5.15.2', | ||
true | ||
); | ||
} | ||
|
||
add_action('init', 'wp_fontawesome_register_font_awesome'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# WP-FontAwesome | ||
|
||
WP-FontAwesome adds Font Awesome to WordPress form Composer. | ||
|
||
The main reason for this is to help with dependencies. Instead of having Font Awesome bundled in both a theme and composer module this allows both to require a single module which by registering the styles/scripts itself means no overlap between multiple installs. | ||
|
||
## Usage | ||
|
||
``` | ||
composer require ed-itsolutions/wp-fontawesome | ||
``` | ||
|
||
```php | ||
//functions.php, in your wp_enqeue_scripts action: | ||
|
||
wp_enqueue_script('font-awesome'); | ||
``` | ||
|