请帮我添加下载链接按钮并将其与页面中心对齐。
提前致谢。
代码编写如下:
<?php
// show download link?
$allow_save = false;
if ( ! empty( $links[1] ) ) { // link empty = secure document; ignore any other save attribute
if ( $save == "all" || $save == "1" ) {
$allow_save = true;
} elseif ( $save == "users" && is_user_logged_in() ) {
$allow_save = true;
}
}
if ( $allow_save ) {
// build download link
$linkcode = '<p class="gde-text"><a href="%LINK%" class="gde-link"%ATTRS%>%TXT%</a></p>';
$linkcode = str_replace( "%LINK%", $links[1], $linkcode );
// fix type
$ftype = strtoupper( $fnp[1] );
if ( $ftype == "TIF" ) {
$ftype = "TIFF";
}
// link attributes
if ( $profile['link_mask'] == "yes" ) {
$attr[] = ' rel="nofollow"';
}
$attr[] = gde_ga_event( $file ); // GA integration
$linkcode = str_replace("%ATTRS%", implode( '', $attr ), $linkcode);
// link text
if ( empty( $profile['link_text'] ) ) {
$profile['link_text'] = __('Download', 'google-document-embedder');
}
$dltext = str_replace( "%FILE", $fn, $profile['link_text'] );
$dltext = str_replace( "%TYPE", $ftype, $dltext );
$dltext = str_replace( "%SIZE", gde_format_bytes( $status['fsize'] ), $dltext );
$linkcode = str_replace( "%TXT%", $dltext, $linkcode );
} else {
$linkcode = '';
}
// link position
if ( $profile['link_pos'] == "above" ) {
$code = $linkcode . "\n" . $vwr;
} else {
$code = $vwr . "\n" . $linkcode;
}
}
}
答案 0 :(得分:0)
它可能对你有帮助
.gde-text{
text-align: center;
}
.gde-text a {
background-color: gold;
border-radius: 10px;
color: green;
font-family: times new roman;
padding: 10px;
text-decoration: none;
}
<p class="gde-text"><a href="%LINK%" class="gde-link"%ATTRS%>%TXT%</a></p>