Customizing Wiki

I have played with this a little and just can not seem to get it to work. I want to include the following just below the title of the single wiki.

<?php $customfield_name = get_post_meta($post->ID, '_ct_text_4e60c64d69a90', true);
if ($customfield_name == '') { ?>
<?php } else { ?>
<div align="center"><?php echo get_post_meta( $post->ID, '_ct_text_4e60c64d69a90', true ); ?></div>
<?php } ?>

Can you tell me how I am able to do this?

  • Philip John
    • DEV MAN’s Apprentice

    Hiya!

    Don't forget to use the code button when pasting code in, just makes it a little easier to read :slight_smile:

    You could do that if slightly better;

    <?php $customfield_name = get_post_meta($post->ID, '_ct_text_4e60c64d69a90', true);
    if ($customfield_name != '') { ?>
    <div align="center"><?php echo get_post_meta( $post->ID, '_ct_text_4e60c64d69a90', true ); ?></div>
    <?php } ?>

    Or maybe;

    <?php if ($customfield_name = get_post_meta($post->ID, '_ct_text_4e60c64d69a90', true)) { ?>
    <div align="center"><?php echo $customfield_name; ?></div>
    <?php } ?>

    See how that works for ya...

    Phil

  • Eric G.
    • The Crimson Coder

    Yeah, the code button does not work all the time for me. Not sure why. I know how and when to use it, I think there is a bug in it somewhere though.

    I am more curious as to where to add the code in files to get that Custom Field to show.

  • Philip John
    • DEV MAN’s Apprentice

    Oh that's weird, sorry about that. Although I think this may have come up before.... Ah yes, that's it! We have a problem with those buttons when starting a thread. Sorry, should have known :slight_smile:

    If you haven't already, you'll need to create your own template for the Wiki plugin.

    Copy your theme's page.php and rename it incsub_wiki.php to create a new template for the wiki pages.

    Then find the bit of the code that has the_title() in it and paste the code below that.

    Phil

  • Mason
    • DEV MAN’s Sidekick

    Hiya,

    Right now, it's actually pretty complex to re-create the entire page template. We're working on adding a do_wiki function so that you can easily call the wiki portions inside your own custom template.

    That should easily suite your purpose here. Right now, it'd require replicating quite a bit of the wiki code inside your page template to get it working properly.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.