WordPress.org

Ready to get started?Download WordPress

Forums

Business Directory Plugin
[resolved] How can I show he content field only? (40 posts)

  1. businessdirectoryplugin
    Member
    Plugin Author

    Posted 1 year ago #

    What I'm saying is that you must use the code above in the right section of the template. You can't just paste it in anywhere, as it won't work. The $listing_id variable is defined within a certain scope of the template's execution, which is why I need to see the exact entire template code that you are currently using, to know what is wrong.

    This sounds like a simple programming error, but without seeing the template, I can't tell you what the exact problem is. I know you posted it already, but since you have changed it afterward, I need the exact, current copy.

  2. spikespiegel
    Member
    Posted 1 year ago #

    The only change I made was in the line after

    <div class="listing-details cf <?php if ($main_image): ?>with-image<?php endif; ?>">

    and before

    <?php
     if ($extra_images): ?>
    <div class="extra-images">
        <ul>
        <?php foreach ($extra_images as $image):  ?>
            <li><?php echo $image; ?></li>
        <?php  endforeach; ?>
        </ul>
    </div>

    I tried it like this and it worked for me:

    $field = wpbdp_get_form_field( 4 );
    $ret = $field->display( $post->ID );
    echo $ret;

    I was talking to a friend and he said the function won't echo, it only returns a string.

    That code worked me, except for the part of displaying the category.

  3. businessdirectoryplugin
    Member
    Plugin Author

    Posted 1 year ago #

    Yes, so the changes you made sound like they are working and it was because the variable $listing_id was not defined, but $post->ID was.

  4. spikespiegel
    Member
    Posted 1 year ago #

    Then why isn't the category displaying? I was able to display shortdescription, title and description using the same scheme, but not the category.

    The category id is 2, I tried it like this and didn't work:

    $field = wpbdp_get_form_field( 2 );
    $ret2 = $field->display( $post->ID );
    echo $ret2;
  5. businessdirectoryplugin
    Member
    Plugin Author

    Posted 1 year ago #

    You don't use the ID of the category, you use the ID of the category field, which is different. Look in the same place you looked for the other field IDs, don't use the ID of the category under Directory->Directory Categories.

  6. spikespiegel
    Member
    Posted 1 year ago #

    That's what I did, I'm looking for the ID in the database.

    I used
    $field = wpbdp_get_form_field( 2 );
    $ret2 = $field->html_value ( $post->ID );
    echo $ret2;

    and it worked, but it didn't display the field name, which is "Category", it only displayed the field value.

    In other words, what should be:

    Category: 1 column templates

    displayed as:

    1 column templates

  7. businessdirectoryplugin
    Member
    Plugin Author

    Posted 1 year ago #

    See this article about html_value, vs. field_value vs. display, which all have different consequences per the WordPress API guidelines.

    http://businessdirectoryplugin.com/support-forum/faq/advanced-customization-of-the-list-and-detail-views-of-bd/

  8. spikespiegel
    Member
    Posted 1 year ago #

    Everything worked great, thx for the great support and patience. You're the best, helped me a lot!

  9. Klarre
    Member
    Posted 4 months ago #

    Hi, I've tried everything in this post but I cant get a meta value called Ort with id 14.

    I'll get the titel to work with the code;

    $field = wpbdp_get_form_field( 1 );
    echo $field->html_value( $listing_id );

    I've tried everything in the above suggestions but I cant get it to work. Is there a problem with getting the meta value?

    I've tried

    $field = wpbpd_get_form_fields( 'association=meta&unique=14' );
    $field->display( $listing_id );

    As suggested.

    I want the list to display title, Ort

    Kind regards
    Klas

  10. Klarre
    Member
    Posted 4 months ago #

    I finaly foud it!

    <?php  $listing_id = get_the_ID(); ?>
    <?php $field = wpbdp_get_form_field( 14 );
     echo $field->display( $listing_id ); ?>

    Worked for me.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.