WordPress.org

Forums

Insert PHP
[resolved] Echoing dollar values, $25.00 turns into .00 (3 posts)

  1. Smaandar
    Member
    Posted 1 year ago #

    If I do, for instance,

    [insert_php]
    
         echo "$25.00";
    
    [/insert_php]

    It displays on the page as:

    .00

    If I do,

    [insert_php]
    
         echo "25.00";
    
    [/insert_php]

    It displays as:

    25.00

    Any ideas as to why this happens, and how to resolve it? I'm not sure if word press is filtering this, and ideas?

    https://wordpress.org/plugins/insert-php/

  2. Smaandar
    Member
    Posted 1 year ago #

    The only fix I've found is to make a custom page template for the page in question in Word Press, and put my php code into there.

  3. WillBontrager
    Member
    Plugin Author

    Posted 1 year ago #

    Smaandar, try
    echo "\$25.00";
    or
    echo '$25.00';

    The $ symbol within double quotes means what follows should be treated as a variable. Escaping it, or putting it in single quotes, bypasses that.

    Will

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Insert PHP
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic