I checked your code in my install. It works, except that you made a typo (missing backslash):
[icon]cog[/icon]
Few notes:
-
You must make sure to enqueue the Font Awsesome stylesheet.
-
You must close the shortcode, like:
[icon]cog[/icon]
-
Remember to escape the class name with
esc_attr()
. -
Another shortcode idea:
[fa icon="cog"]
Related Posts:
- WordPress menu deletes when trying to add a hook
- PHP contact form returns warning in text widget [closed]
- Add a specific part of current category page url to shortcode
- WordPress Shortcodes.. printf is outputting a random number… Can’t figure out WHY?
- How to Create custom block for displaying information in content section which act like shortcode
- Shortcodes not processing inside post content
- I want to hide “sold by” on certain pages with id page 43
- Reload page with a different shortcode when a user selects from a dropdown
- PHP Widget and do_shortcode
- How to edit a widget code?
- How to include checkbox in widget backend form?
- Limit the number of inactive widgets
- Shortcode to insert
- Shortcode putting html such as
- Shortcode from a widget is wrapped in unwanted element
- Transform php code into a widget?
- WordPress widget in custom theme
- Using Echo in ShortCode – Stuck
- Infinite-Scroll Plugin and Jetpack Infinite Scroll Plugin – Adding to “Thoughts” Theme
- Multiple do_shortcode($content) within one shortcode
- My shortcode is showing up twice
- Custom plugin issue when trying to use the shortcode twice on a page [closed]
- How To Change The Html of Products filtration sidebar in Woocommerce?
- Nested shortCode functions in the functions.php file
- get_page_by_title with an apostrophe in variable
- How to group 2 radio buttons in a widget?
- Get posts with at least one category in common with current post?
- How can I get content inside one shortcode to another shortcode?
- Use WP_Query in shortcode
- Missing sidebar parameter “fix” – before_content
- Change the site tagline (or similar) based on current page
- Custom filter in admin edit custom post type responding with invalid post type?
- Ajax category filtering products default show all
- How to exclude category ID from Looper in WordPress
- Calculating a large number of MYSQL queries as customshort codes, slow
- Print last modified date only on posts
- How to add an arrow to menu items has submenus
- How can I dynamically update the class in my shortcode?
- Hide subcategories (widget)
- How to edit widget code to add unique class name to each div?
- Change tinyMCE editor to allow marked content when pasting from Word
- How to Reference/Echo Variable from Another PHP Function
- Replace shortcode in substring
- Archives shortcode displaying above widget title
- How to make modifications only to certain elements of an HTML string on the server-side?
- displaying content that includes shortcodes within an echo
- List taxonomy term slugs within shortcode (do_shortcode)
- Display Data in Table from External Database in WP using Shortcodes
- Capitalize Shortcode Value on Output
- Why is my str_replace not working on short code submitted by front-end?
- How to append to an array and return the results in a filter?
- Shortcode not staying inside div tag
- Shortcodes within the sidebar text/html widget: How to preserve the raw HTML output of the shortcode?
- Help Fallback (thumbnail)
- wrap a span tag around author’s post count
- How to return a string that has a jQuery and Ajax inside in a shortcode?
- Shortcode function doesnt work without caption
- Show different website layout if no sidebar added
- Create special button on WP Tiny MCE Posts Editor for Shortcodes
- Display logged in user name and lastname on page
- Test the existence of a page/article by its URL, taking in consideration the URL rewriting by filters
- Retrieve the whole widget sidebar and pass it inside an html
- Filter ‘comment_notification_text’ not working
- Replace background image with post thumbnail in shortcode
- Conditional formatting on data fetched from MYSQL
- Remove span tags from WooCommerce Downloads page
- Having trouble creating two shortcodes, one for logged in user and one for visitors
- How to edit post meta data before publishing the post it self wordpress?
- How to change href of a Widget menu item link?
- Display current user metadata on WordPress page
- Add Shortcode to ::before class
- How Can I Display the Last Modified Date for User Profiles on WordPress?
- WordPress Ajax filter: Create two loops for different output styles?
- How to display custom seo title before the loop?
- Shortcode’s output to use as other shortcode’s parameter
- Customizing the output of the archive and category widget without altering the original behavior of the widget
- Featured Products not showing up in “Featured” area of homepage
- How to remove title tag with this filter
- Add two or multiple functions in WordPress Post or Page
- Shortcode Works for Logged in Users but Not Working for Guest
- perform mathematical operation on shortcode
- Update same content in multiple posts at once?
- Widget Update problems using a for loop
- How can the searchform.php know if it’s used on a registered sidebar id ‘sidebar-1’ or ‘sidebar-2’?
- Non-static method error when trying to use class in widgets
- problem multisite with blog id
- Get terms of the posts with one query
- Create dynamic content from one WP page to multiple other pages
- Woocommerce Price Text
- Limit Taxonomy Parents
- Display a post based on its metabox selection
- Shortcode Display From WordPress Dashboard Page Without Using post_id
- List sibling pages widget, exclude current page
- Do_shortcode on PHP file outside theme ALMOST works
- dynamically filter by category via sub-menu
- Edit the Publish Widget Options
- Custom Shortcode with Dynamic Button
- Shortcode for Visual Composer Grid fails turning string to integer
- how to check elementor is widget is active or loaded
- How to pass value to add_filter wpcf7_form_tag from another function?