{"id":1950918,"date":"2021-09-22T03:59:04","date_gmt":"2021-09-22T07:59:04","guid":{"rendered":"https:\/\/theeventscalendar.com\/knowledgebase\/?post_type=tribe-knowledgebase&#038;p=1950918"},"modified":"2025-01-17T06:30:11","modified_gmt":"2025-01-17T11:30:11","slug":"separating-the-event-cost-and-the-currency-symbol","status":"publish","type":"post","link":"https:\/\/theeventscalendar.com\/knowledgebase\/separating-the-event-cost-and-the-currency-symbol\/","title":{"rendered":"Separating the Event Cost and the Currency Symbol"},"content":{"rendered":"\n<p>With <strong>The Events Calendar<\/strong>, you can easily <a href=\"https:\/\/theeventscalendar.com\/knowledgebase\/k\/creating-an-event\/#Event_Cost\">set a cost for events<\/a>, define the currency symbol, and decide whether the symbol appears before or after the cost. While this setup works well for common symbols like <code>$<\/code> or <code>\u20ac<\/code>, issues can arise if you prefer using currency abbreviations, such as \u201cEUR\u201d or \u201cUSD\u201d since the cost and abbreviation will display without a space (e.g., <code>100EUR<\/code>).<\/p>\n\n\n\n<p>Thankfully, there are easy ways to fix this formatting issue.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-option-1-add-a-space-manually\"><strong>Option 1: Add a Space Manually<\/strong><\/h2>\n\n\n\n<p>To insert a space between the cost and the currency abbreviation:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Enter the currency abbreviation with a space in the appropriate field.<br>For example:\n<ul class=\"wp-block-list\">\n<li>Use <code>_EUR<\/code> or <code>EUR_<\/code> (underscore added here for clarity; replace it with a space).<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p>This method ensures that your cost will display as <code>100 EUR<\/code> instead of <code>100EUR<\/code>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/03\/Screen-Shot-2022-03-16-at-11.24.07-AM-2.png\" alt=\"Event Cost field in the Classic Editor\" class=\"wp-image-1952321\"\/><figcaption class=\"wp-element-caption\">Event Cost field in the Classic Editor<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/03\/Screen-Shot-2022-03-16-at-11.22.18-AM-1.png\" alt=\"Event Cost field in the Block Editor\" class=\"wp-image-1952313\"\/><figcaption class=\"wp-element-caption\">Event Cost field in the Block Editor<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-option-2-adjust-settings-for-currency-symbols\"><strong>Option 2: Adjust Settings for Currency Symbols<\/strong><\/h2>\n\n\n\n<p>If you want to define a default currency symbol or code, follow these steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Navigate to <strong>Events > Settings > Display<\/strong> in your WordPress dashboard.<\/li>\n\n\n\n<li>Locate the <strong>Currency Settings<\/strong> section.<\/li>\n\n\n\n<li>Add your desired currency symbol or abbreviation here.<\/li>\n<\/ol>\n\n\n\n<p>You can also define whether the symbol should appear <strong>before or after<\/strong> the cost.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/03\/Screen-Shot-2022-03-16-at-11.20.42-AM.png\" alt=\"Currency options under Events Settings &gt; General.\" class=\"wp-image-1952323\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-option-3-use-code-snippets-for-greater-control\"><strong>Option 3: Use Code Snippets for Greater Control<\/strong><\/h2>\n\n\n\n<p>For more advanced customization, you can use snippets to control the placement and format of the currency symbol or code. Add the appropriate snippet to a custom plugin or your child theme&#8217;s <code>functions.php<\/code> file. For more advanced customization, you can use snippets to control the placement and format of the currency symbol or code. Add the appropriate snippet to a custom plugin or your child theme&#8217;s <code>functions.php<\/code> file.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-if-the-currency-symbol-like-is-before-the-cost\"><strong>If the currency symbol (like \u20ac) is before the cost:<\/strong><\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/ Add a space before the Euro symbol\nadd_filter( &#039;tribe_get_cost&#039;, &#039;add_space_before_euro&#039; );\n\nfunction add_space_before_euro( $cost ) {\n    if ( is_admin() ) {\n        return $cost;\n    }\n    $cost = str_replace( &#039;\u20ac&#039;, &#039; \u20ac&#039;, $cost );\n    $cost = str_replace( &#039;&amp;euro;&#039;, &#039; &amp;euro;&#039;, $cost );\n    $cost = str_replace( &#039;&amp;#8364;&#039;, &#039; &amp;#8364;&#039;, $cost );\n\n    return $cost;\n}\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-if-the-currency-symbol-is-after-the-cost\"><strong>If the currency symbol is after the cost:<\/strong><\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\nadd_filter( &#039;tribe_get_cost&#039;, &#039;add_space_before_dollar&#039; );\n\nfunction add_space_before_dollar( $cost ) {\n    if ( is_admin() ) {\n        return $cost;\n    }\n    $cost = str_replace( &#039;$&#039;, &#039; $&#039;, $cost );\n    $cost = str_replace( &#039;&amp;#36;&#039;, &#039; &amp;#36;&#039;, $cost );\n\n    return $cost;\n}\n<\/pre><\/div>\n\n\n<p>By using one of these methods, you can ensure that your event cost formatting looks clean and professional, whether you\u2019re using symbols or abbreviations. Choose the approach that works best for your setup and design preferences.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>With The Events Calendar, you can easily set a cost for events, define the currency symbol, and decide whether the symbol appears before or after the cost. While this setup works well for common symbols like $ or \u20ac, issues can arise if you prefer using currency abbreviations, such as \u201cEUR\u201d or \u201cUSD\u201d since the&#8230;<\/p>\n","protected":false},"author":5,"featured_media":1955565,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_swpsp_post_exclude":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"ep_exclude_from_search":false,"footnotes":""},"categories":[24,59,79],"tags":[20,25,58],"stellar-product-taxonomy":[161],"class_list":["post-1950918","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-customizing","category-php-function-snippets","category-snippets","tag-code","tag-customizations","tag-php","stellar-product-taxonomy-the-events-calendar"],"acf":[],"taxonomy_info":{"category":[{"value":24,"label":"Customizations"},{"value":59,"label":"PHP Functions &amp; Snippets"},{"value":79,"label":"Snippets"}],"post_tag":[{"value":20,"label":"Code"},{"value":25,"label":"Customizations"},{"value":58,"label":"PHP"}],"stellar-product-taxonomy":[{"value":161,"label":"The Events Calendar"}]},"featured_image_src_large":["https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/02\/social-share-1024x538.png",1024,538,true],"author_info":{"display_name":"Leah","author_link":"https:\/\/theeventscalendar.com\/knowledgebase\/author\/leahk\/"},"comment_info":0,"category_info":[{"term_id":24,"name":"Customizations","slug":"customizing","term_group":0,"term_taxonomy_id":24,"taxonomy":"category","description":"","parent":0,"count":157,"filter":"raw","term_order":"0","cat_ID":24,"category_count":157,"category_description":"","cat_name":"Customizations","category_nicename":"customizing","category_parent":0},{"term_id":59,"name":"PHP Functions &amp; Snippets","slug":"php-function-snippets","term_group":0,"term_taxonomy_id":59,"taxonomy":"category","description":"","parent":24,"count":127,"filter":"raw","term_order":"0","cat_ID":59,"category_count":127,"category_description":"","cat_name":"PHP Functions &amp; Snippets","category_nicename":"php-function-snippets","category_parent":24},{"term_id":79,"name":"Snippets","slug":"snippets","term_group":0,"term_taxonomy_id":79,"taxonomy":"category","description":"","parent":0,"count":80,"filter":"raw","term_order":"0","cat_ID":79,"category_count":80,"category_description":"","cat_name":"Snippets","category_nicename":"snippets","category_parent":0}],"tag_info":[{"term_id":20,"name":"Code","slug":"code","term_group":0,"term_taxonomy_id":20,"taxonomy":"post_tag","description":"","parent":0,"count":19,"filter":"raw","term_order":"0"},{"term_id":25,"name":"Customizations","slug":"customizations","term_group":0,"term_taxonomy_id":25,"taxonomy":"post_tag","description":"","parent":0,"count":102,"filter":"raw","term_order":"0"},{"term_id":58,"name":"PHP","slug":"php","term_group":0,"term_taxonomy_id":58,"taxonomy":"post_tag","description":"","parent":20,"count":78,"filter":"raw","term_order":"0"}],"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1950918","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=1950918"}],"version-history":[{"count":4,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1950918\/revisions"}],"predecessor-version":[{"id":1963952,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1950918\/revisions\/1963952"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media\/1955565"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=1950918"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=1950918"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=1950918"},{"taxonomy":"stellar-product-taxonomy","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/stellar-product-taxonomy?post=1950918"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}