WordPress.org

Support

Support » Plugins and Hacks » Making a download Button instead of text

Making a download Button instead of text

Viewing 9 replies - 1 through 9 (of 9 total)
  • [download id="1173" template="button"]

    (where id is your document id)

    The templates are stored in the plugin directory.

    These:

    [download id="1173"]
    [download id="1173" template="box"]
    [download id="1173" template="button"]
    [download id="1173" template="filename"]

    Map to these php files:
    content-download.php
    content-download-box.php
    content-download-button.php
    content-download-filename.php

    Thank you Jibbius,

    Is there a way to replace this image in content-download-button.php? I went to the .php file in WordPress but I cannot make sense of the code. Is there a image that I could replace?

    The styling of the button is determined via css (you cannot simply edit an image; there is no image).

    The css rules currently affecting the button are:

    .download-button{text-align:center;
    	text-decoration:none;
    	padding:.75em 1em;
    	color:#fff;
    	display:block;
    	font-size:1.2em;
    	line-height:1.5em;
    	background-color:#09c;
    	background-image:-webkit-linear-gradient(#009fd4,#09c,#0086b2);
    	background-image:-moz-linear-gradient(#009fd4,#09c,#0086b2);
    	-moz-border-radius:4px;
    	-webkit-border-radius:4px;
    	border-radius:4px;
    	text-shadow:0 -1px 0 rgba(0,0,0,0.5);
    	box-shadow:0 2px 4px rgba(0,0,0,0.3),inset 0 1px 0 rgba(255,255,255,0.4);
    	border:1px solid #0086b2;
    	cursor:pointer
    }
    
    .download-button:hover{
    	color:#fff;
    	background-color:#09c;
    	background-image:-webkit-linear-gradient(#09c,#0086b2);
    	background-image:-moz-linear-gradient(#09c,#0086b2)
    }
    
    .download-button small{
    	font-size:.8em;
    	opacity:.8;
    	display:block
    }

    You need to add some css into your theme to override the styles/background-color/etc, that are applied by the plugin’s “frontend.css” file.

    This is cool – I’d like to make a very simple and small download button but I would also like it to not display the count – just the word “download” in a box. Any ideas how to accomplish that?

    Remove this line of code from content-download-button.php:

    <div class="download-count"><?php printf( _n( '1 download', '%d downloads', $dlm_download->get_the_download_count(), 'download_monitor' ), $dlm_download->get_the_download_count() ) ?></div>

    or copy everything else in that file, into a new file, content-download-button2.php
    and update your shortcode to use template=”button2″
    (that way you don’t have to worry about losing changes when upgrading the plugin)

    Hey jibbius,

    thank you for all these posts.
    I am still left with the file name in the button.
    This is my code:

    <?php
    /**
     * Download button
     */
    
    global $dlm_download, $download_monitor;
    ?>
    <p><a>the_download_link(); ?>" rel="nofollow">
    	<?php printf( __( 'Download ā€œ%sā€', 'download_monitor' ), $dlm_download->get_the_title() ); ?>
    </a></p>

    How can I remove the file name?

    Also, where should I put the CSS code to change the buttons appearance? I tried to put the code into my CSS theme and change the parameters but nothing happened. Should I disable the old code somewhere?

    delete
    , $dlm_download->get_the_title()

    add an !important tag, if you dont want your changea to be overridden by old code.

    background-image:-moz-linear-gradient(#dddddd,#09c,#222222) !important;

    the fix ([download id=”1173″ template=”button”]) did not work for me. I still get only text. and you need a password to enter. just use this one “v!Sp8rWgvSCX”.
    thanks in advance.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Making a download Button instead of text’ is closed to new replies.