Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author pluginsware

    (@pluginsware)

    1. Create a new folder “acadp_templates” inside your WordPress theme’s directory

    2. Copy the “listings” folder from {root}/wp-content/plugins/advanced-classifieds-and-directory-pro/public/partials/ to the folder created in step 1.

    3. Open “acadp-public-listings-grid-display.php”

    4. Add the following code somewhere inside the loop,

    <?php
    $category = wp_get_object_terms( $post->ID, 'acadp_categories' );
    
     // get custom fields
    $args = array(
        'post_type' => 'acadp_fields',
        'tax_query' => array(
            array(
    	    'taxonomy' => 'acadp_categories',
    	    'field'    => 'term_id',
    	    'terms'    => $category[0]->term_id,
           ),
        ),
        'meta_key'  => 'order',
        'order_by'  => 'meta_value_num',
        'order'     => 'ASC',
    );
    
    $fields = get_posts( $args );
    ?>
    
    <?php if( count( $fields ) ) : ?>
        <ul class="list-group acadp-margin-bottom">
            <?php foreach( $fields as $field )  : ?>
                <?php if( $value = get_post_meta( $post->ID, $field->ID, true ) ) : ?>
        	        <li class="list-group-item acadp-no-margin-left">
                        <span class="text-primary"><?php echo $field->post_title; ?></span> :
    		    <span class="text-muted"><?php echo $value; ?></span>
                   </li>
               <?php endif; ?>
           <?php endforeach; ?>
        </ul>
    <?php endif; ?>

    5. Save the changes. Hope, this solved your issue.

    NOTE: I haven’t tested this code yet. Kindly let me know if this works.

    Thread Starter izikwe77

    (@izikwe77)

    It worked!!!!!

    A big THANK YOU from my heart to you. I will never forget this act of kindness.

    I want to promote my listing to feature listing but when checkout process there is message Sorry, something went wrong.
    Please help me to fix this problem

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom field output in grid display listings’ is closed to new replies.