• Resolved bosal

    (@bosal)


    Hello,
    I need to make a news portal from a wordpress. And I need a little function.

    IN the posting form, i need to have a field Comment ID. Becouse I want to disable commenting on wordpress, and linking it to my forum.

    It would work like this, admin writes a post, when he wants
    that the post will be discussed, he just ener a Thread ID in a field under the msg body. He makes the thread erlyer by himself, and he has the Thread ID.

    When he add the ID, on mine site, and post view, on the bootem there, is a link https://sitename.com/showthread.php?id=IDThAThehasadded , when he leave the field blank, there will be no link on the mine site.

    Can somebody help me with this?

    Best reg.
    KB

Viewing 7 replies - 1 through 7 (of 7 total)
  • Chris_K

    (@handysolo)

    Probably start here: Using_Custom_ Fields and learn about custom fields and their uses. I’d propose you’d use one to store the forum url — then pull it out when the post is displayed for the link.

    Thread Starter bosal

    (@bosal)

    I still don’t know how to use it. Plz take me few more steps forward.

    Kafkaesqui

    (@kafkaesqui)

    Easiest steps I know:

    1. Add a custom field to each post. Give it a key of ‘ID’, with the value being the thread ID #.

    2. In your active theme’s templates (likely single.php, or possibly index.php, or both) where you want to display your ‘comment’ link, add this bit of code:

    <?php
    $thread_id = get_post_custom_values('ID');
    if( $thread_id[0] ) :
    ?>
    <a href="https://sitename.com/showthread.php?id=<?php echo $thread_id[0]; ?>Comment on forum</a>
    <?php endif; ?>

    Thread Starter bosal

    (@bosal)

    It doesn’t work, I’ve added a KEY “ID” or “thread_id” and in the value i’ve entered a post ID, then i’ve added the code, and added a post with the custom field nothing shows.

    Thread Starter bosal

    (@bosal)

    How can I do it ?

    Thread Starter bosal

    (@bosal)

    I’ve made it little bit else
    // <?php
    //$thread_id = get_post_custom_values('ID');
    //if( $thread_id[0] )
    //{ echo "<p align=right><a><span class=post-comment>Przedyskutuj na forum</a></span></p>"; }
    //else { }
    // ?>

    uh hello?
    your <A> anchor is empty.

    would be better for you to have something like

    <A HREF=”yoursite.com/?t=$thread_id[0]”></A>

    And note that yoursite.com needs to be replaced by your actual site.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to make a new field in postbit?’ is closed to new replies.