Viewing 6 replies - 1 through 6 (of 6 total)
  • As the WordPress tags are processed AFTER the PHP is executed, you will not be able to get the amount into your PHP script. I would suggest to go inside the PHP of the script and add that functinality you need directly into the plugin.

    I encountered the same problem when writing a additional shortcode in my ‘functions.php’ file for the custom theme i build.
    This works fine for me:

    do_shortcode('[wpdonatecollected cid='. $value .']');

    Where $value is the variable containing the cid.

    Thread Starter sammcdade

    (@sammcdade)

    That is exactly how I did it and got it working! I should have posted to say I had solved the problem. I’m glad you found the solution as well!

    more explanations please if the cid = 001, where do you put that info?

    like do_shortcode(‘[wpdonatecollected cid=’. 001 .’]’);

    or

    do_shortcode(‘[wpdonatecollected cid=’. 1 .’]’);

    or ?

    thanks

    Normally you would like to use this code with a user-defined cID, otherwise I don’t really see a use for it, but when you would like your PHP code to always use the same cID you could use the following:

    <?php
    $cID = 1;
    do_shortcode('[wpdonatecollected cid=' . $cID . ']');
    ?>

    Without use of the $cID variable you could use the following:

    <?php
    do_shortcode('[wpdonatecollected cid=1]');
    ?>

    The interface for the plugin shows the cIDs with leading zero’s (e.g. 001), but in the database and in the PHP code it’s just an integer (e.g. 2 or 15). So in PHP code just use the cID without leading zero’s.

    thank you for explaining.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Grabbing Total Amount Collected for Use in PHP’ is closed to new replies.