Support » Plugin: WooCommerce » I give – What are the Available Download Shortcodes

Viewing 13 replies - 1 through 13 (of 13 total)
  • I don’t understand your question. I don’t think your downloads are stored in your downloads.php file. Php files have scripts that tell the server what to do. You downloads will be most likely stored in a folder. Are you trying to sell digital products? What do you mean when you say that they don’t show up on your account page? Are you saying that you have downloads that only people who have accounts can download? Are you unable to download those products once you are logged in as a member? If you can give me a better description I can help you.

    Sorry I misunderstood. What you need to do is copy all the code in the my-downloads.php file and copy it into your functions.php file. Before you do anything with your functions.php file, back it up so you can revert back to it if you break your site. Paste the code into the top or bottom of functions.php or at least between the existing functions. When you find a good place to put your shortcode function, do it like this:

    function download_shortcode(){
    Place all the code that you are pasting right here
    add_shortcode(‘downloads’), ‘download_shortcode’)

    Don’t paste it inside of an already existing function. Notice that below the code that you put in put the following code:
    add_shortcode(‘downloads’, ‘download_shortcode’)
    This code creates the shortcode.
    Then you can call put the shortcode in your page or post like this:

    Let me know if it works and if you need more help, let me know.

    I tried functions.php in the includes folder and woocommerce-functions.php and ftp’ed in the charges where I pasted

    function download_shortcode(){
    Place all the code that you are pasting right here
    add_shortcode(‘downloads’), ‘download_shortcode’)

    at the very bottom under everything else so not to mess with another function.

    Both times I got errors like

    Parse error: syntax error, unexpected T_STRING in /my stuff/wp-content/plugins/woocommerce/woocommerce-functions.php on line 1737

    Thank for the help and any thoughts on what I’m doing wrong?

    BTW: I did a bit of research and read about adding functions to the shortcodes.php and got the same error.


    Do the shortcodes go in the theme?


    I use below following the tutor I found so I could learn to make my own shortcodes but it doesn’t work. I did find out how to put functions.php in my child theme.

    // Add Shortcode
    function download_shortcode() {

    // Code
    return ”;
    add_shortcode( ‘my-download.php’, ‘download_shortcode’ );

    One last posting tonight. I found woocommerce_available_download_link filter but could really use some advice how to use it.

    The shortcodes.php in the Includes file is a core wp file. Don’t mess with it. The functions.php file in the Includes folder or the one in the woocommerce plugin file are not the functions.php file you are looking for. The functions.php you are looking for is in your wp-content/themes folder. Some theme developers put custom php functionss in a different folder, but usually you can find it in the themes folder. So it will be in a folder like this:

    If you are putting the code in the functions.php in the child theme, then that is the correct functions.php file

    Also, add the $atts array parameter to the function arguments. It may not need it, but it can’t hurt. That way it will be there if it needs it. Do it like this:

    function ($atts){
    Paste all the code that you copied from the my-downloads.php file here.
    add_shortcode( ‘my-download.php’, ‘download_shortcode’ );

    If you are working with a Wootheme, then they usually will put a comment in the functions.php file in that looks like this:

    /* You can add custom functions below */

    When you see it you will be in the right place. If your theme uses a different file to put custom functions in, it should refer to it in the functions.php file that is inside of your themes folder. For instance, one theme I work with has a line in the functions.php file like this:

    require_once locate_template(‘/lib/custom.php’); // Custom functions

    That means that the custom functions or shortcodes should be put in myThemeFolder/lib/custom.php file.

    In answer to your question: “Do the shortcodes go in the theme?”

    The short codes go in the page or post. Log into your wp dashboard. Then depending on whether you are trying to put your downloads on a Page or Post, click on the appropriate choice. If Downloads is a page, on the menu in the left sidebar click Page > Downloads. Then put your short code in the page editor just like any other text you want to show up in the content area of your page. You can put the short code in a template file, but I don’t think that’s what you want.

    after you add the short code function and add_shortcode() call and place the shortcode in your page, then refresh your website. If you get an error message then post it here.

    Today I forgot that I tried to help you here yesterday. So tomorrow I will try to remember to check back and see how you are progressing.

    Thank so very much. I get it a lot better now.

    I thought I understood but I keep getting errors. I decided to switch gears for one day to see if it helped to take a step back and try again tomorrow. I really want to learn short codes but I really only need available download to show on one page. I decided to spend today reading up on hooks since I found hook woocommerce_available_download_link to file my-downloads.php at

    I thank you for all your help. Shortcodes are on my list to learn but not today 🙂

    The problem is not how you are using the shortcode. If you use an action hook the same exact thing will happen. The problem is with the function. Copy and paste the function that I have provided here into your functions.php file and let me know if you still get an error. If you don’t get an error, then put the short code in your page or post content like this: [downloads]
    Let me know if it works.

    Hi, sorry it too me so long to get back to you. A charity event which will thank goodness be over this week took over my life.

    I tried your codes and it till takes down my web site no matter how I do this.

    I’m putting this functions.php in the wp-content/themes/responsive-childtheme-pro-child-theme folder


    No problem. Are you using a wootheme? If so, then which wootheme are you using? If not, let me know what theme you are using. When it breaks the website, does it give you an error message? If so, then post it here. Also, copy and paste the file that the error code refers to in the ubuntu paste bin and click on the paste button at the bottom. Post the link that the paste bin generates in here.

    So go ahead and put the code back in functions.php and break your site so you can get the error message and paste it here. Then copy and paste the file that is referred to in the error message in the ubuntu pase bin and put the link here.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘I give – What are the Available Download Shortcodes’ is closed to new replies.