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

About Custom Icon in fontawesome field #127

Open
ashikur11 opened this issue Mar 3, 2019 · 0 comments
Open

About Custom Icon in fontawesome field #127

ashikur11 opened this issue Mar 3, 2019 · 0 comments

Comments

@ashikur11
Copy link

ashikur11 commented Mar 3, 2019

Hi there,
How can i extend fontaweome field? i want to be there more icon like flaticon, icomoon icon. i am trying like this

function vp_get_fontawesome_icons()
{
	// scrape list of icons from fontawesome css
	if( false === ( $icons  = get_transient( 'vp_fontawesome_icons' ) ) )
	{
		$pattern = '/\.(fa-(?:\w+(?:-)?)+):before\s+{\s*content:\s*"(.+)";\s+}/';
		$subject = file_get_contents(VP_DIR . '/public/css/vendor/font-awesome.min.css');
		preg_match_all($pattern, $subject, $matches, PREG_SET_ORDER);
		$icons = array();
		//fontawesome
		foreach($matches as $match)
		{
		    $icons[] = array('value' => 'fa '.$match[1], 'label' => $match[1]);
		}

		

		$pattern2 = '/\.(flaticon-(?:\w+(?:-)?)+):before\s+{\s*content:\s*"(.+)";\s+}/';
		$subject2 = file_get_contents(get_template_directory_uri(). '/css/flaticon.css');
		preg_match_all($pattern2, $subject2, $matches2, PREG_SET_ORDER);
		$icons = array();
		//flaticon
		foreach($matches2 as $match2)
		{
		    $icons[] = array('value' => 'fa '.$match2[1], 'label' => $match2[1]);
		}

		set_transient( 'vp_fontawesome_icons', $icons, 60 * 60 * 24 );
	}
	return $icons;
}

but it's only returning fontawesome icons.

Please help.

Regards,
Ashikur.

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

1 participant