• Hi,

    Although I’ve used WordPress for a little while, I’m new to certain aspects and PHP. Trying to use this plug in to have multiple editable text areas. It all seems to work in WP admin, but on the page the content is appearing minus with the markup, without the look…

    I’m not sure what code to put in my page.php template, but have copied and edited this from a page I found.

    Top of page:

    <?php
    $extracontent = htmlspecialchars(get_post_meta($post->ID, "extracontent", true));
    ?>

    and in the page where the I want the content:

    <?php
    if ($extracontent != "") {
        echo '<p class="extracontent">' . $extracontent . '</p>';
    }
    ?>

    Clearly my custom field is called extracontent.

    I guess this is what is wrong…. anyone help please?

    http://wordpress.org/extend/plugins/custom-field-template/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter janleeks

    (@janleeks)

    Fiddling around (and guessing) I have got it working I think, still any help would be useful…

    I’ve changed the top code to:

    <?php
    // Retrieve custom meta values from post if they're present
    $extracontent = (get_post_meta($post->ID, "extracontent", true));
    ?>

    and the second bit to:

    ` <?php
    if ($extracontent != “”) {
    echo ‘<p>’ . $extracontent . ‘</p>’;
    }`
    ?>

    My formatting seems to be coming in now, if anyone can tell me if I am doing this right or wrong, please let me know.

    Regards

    Jan

    Thread Starter janleeks

    (@janleeks)

    Im still having issues, the <p> tags just dont appear after edits… any ideas??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Field Template – new to this and struggling getting text to format’ is closed to new replies.