Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

Help po mga wordpress user and php masters

shiapouf

Proficient
Advanced Member
Messages
262
Reaction score
0
Points
26
Di ko po kasi mapagana tong code, gumawa po ako ng sarili kong post type and may nakita ako sa net about sa metabox na may upload pdf, so inimpliment ko sya as of now di ko mapagana yung download link nya pano po kaya un.. pa help naman po plss

same lng ng codings yung mga nakikita ko but d ko mapagana. pa help po
add_action("admin_init", "pdf_init");
add_action('save_post', 'save_pdf_link');
function pdf_init(){
add_meta_box("my-pdf", "PDF Document", "pdf_link", "Newsletter", "normal", "low");
}
function pdf_link(){
global $post;
$custom = get_post_custom($post->ID);
$link = $custom["link"][0];
$count = 0;
echo '<div class="link_header">';
$query_pdf_args = array(
'post_type' => 'attachment',
'post_mime_type' =>'application/pdf',
'post_status' => 'inherit',
'posts_per_page' => -1,
);
$query_pdf = new WP_Query( $query_pdf_args );
//$pdf = array();
echo '<select name="link">';
echo '<option class="pdf_select">SELECT pdf FILE</option>';
foreach ( $query_pdf->posts as $file) {
if($link == $pdf[]= $file->guid){
echo '<option value="'.$pdf[]= $file->guid.'" selected="true">'.$pdf[]= $file->guid.'</option>';
}else{
echo '<option value="'.$pdf[]= $file->guid.'">'.$pdf[]= $file->guid.'</option>';
}
$count++;
}
echo '</select><br /></div>';
echo '<p>Selecting a pdf file from the above list to attach to this post.</p>';
echo '<div class="pdf_count"><span>Files:</span> <b>'.$count.'</b></div>';
}
function save_pdf_link(){
global $post;
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE){ return $post->ID; }
update_post_meta($post->ID, "link", $_POST["link"]);
}
add_action( 'admin_head', 'pdf_css' );
function pdf_css() {
echo '<style type="text/css">
.pdf_select{
font-weight:bold;
background:#e5e5e5;
}
.pdf_count{
font-size:9px;
color:#0066ff;
text-transform:uppercase;
background:#f3f3f3;
border-top:solid 1px #e5e5e5;
padding:6px 6px 6px 12px;
margin:0px -6px -8px -6px;
-moz-border-radius:0px 0px 6px 6px;
-webkit-border-radius:0px 0px 6px 6px;
border-radius:0px 0px 6px 6px;
}
.pdf_count span{color:#666;}
</style>';
}
function pdf_file_url(){
global $wp_query;
$custom = get_post_custom($wp_query->post->ID);
echo $custom['link'][0];
}

function update_edit_form(){
echo 'enctype="multipart/form-data"';
}
add_action('post_edit_form_tag', 'update_edit_form');


and eto po ung sa download link po
<button type="button" class="btn btn-default"><a href=" <?php pdf_file_url(); ?>">Download </a></button>


Ang problem ko po kasi once na click ko si DOWNNLOAD button di po sya nag ddownload, napunta lang sya sa link na ito.


pa help po pls
 
Last edited:
may kulang ka pa siguro na plugins sa wp mo.
 
yun din po sir hinala ko kasi, nag reredirect naman sya sa filepath nya then nag try ako na mag refresh gamit re enter ng url nya ayun nadodownload naman po, di ko alam kung ano kulang nakakainis, kahit sa pag add lang ng link ayaw din nag reredirect lng sya, di ko naman makuhang tamang term para ma search ko kay pareng google, nakakainis eh

- - - Updated - - -

Ok na sir, napagana ko na sya, haha nakakainis eh
 
Back
Top Bottom