WordPress.org

Ready to get started?Download WordPress

Forums

POST2PDF Converter
displaying post meta data (4 posts)

  1. norix
    Member
    Posted 2 years ago #

    Hi redcocker, I am trying to get the post meta (meta_value) into the pdf file output, but I have so far no success. Could you help me to figure out how to do that?
    Thanks in advance.

    http://wordpress.org/extend/plugins/post2pdf-converter/

  2. redcocker
    Member
    Plugin Author

    Posted 2 years ago #

    Hi, novic7 san

    To get post meta data and insert it into your post, you can add the following code into post2pdf-converter-pdf-maker.php(around line 371).

    $key_value = get_post_meta($post_id, 'YOUR_KEY', true);
    $content = $content + $key_value;

    or

    $key_value = get_post_meta($post_id, 'YOUR_KEY', true);
    $content = $key_value + $content;

    Ref.: http://codex.wordpress.org/Function_Reference/get_post_meta

  3. diezel
    Member
    Posted 2 years ago #

    Hello redcocker,

    I really like this plugin that converts the post to pdf. I have the same problem as novic7. The code that you provided seems to be working but I have to do $content = $key_value;otherwise it will not work. The problem was the post will not appear in the PDF output every time I insert your code in line 371 of post2pdf-converter-pdf-maker.php. The only thing that will be displayed is the value of the $content

    I also cannot display all 10 post metadata that I have for each post. Do you have a code that will query or display all post metadata for this plugin.

    Your help will be very much appreciated.

    Thanks,

    Diezel

  4. redcocker
    Member
    Plugin Author

    Posted 2 years ago #

    Hi, novic7 san, diezel san

    Sorry, I made a simple mistake.

    Please add following code instead of previous code.

    $key_value = get_post_meta($post_id, 'YOUR_KEY', true);
    $content = $content.$key_value;

    or

    $key_value = get_post_meta($post_id, 'YOUR_KEY', true);
    $content = $key_value.$content;

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic