Enabling shortcode in a plugin custom field

Hello!
I'm wondering if it's within the realm of super hero support to receive help on enabling short codes in custom fields that I create in a non-wpmudev plugin. In case it is, I've granted support access & it's the Classifieds and Directory plugin.
Thanks in advance!

  • Ash

    Hello Debbie

    Shortcode support in custom field is really helpful. In fact, it's not the custom field who supports the shortcode, it's how you show in the template as output. If you use to show directly on page template, you just need to pass as an argument of do_shortcode function. For example, if you have $var containing the value of custom field, you can write like this:

    <?php
    echo do_shortcode( $var );

    So, would you please tell me how are you showing the output of the custom field? And which plugin you are using to create custom field? Then I may try to help to modify the output.

    Have a nice day!

    Cheers,
    Ash

  • Ash

    Happy new year Debbie :slight_smile:

    Though I am not familiar with that plugin, I have taken a quick look at the source. Unfortunately, I didn't find any solution.

    Would you please tell me how do you show the value of that custom field on the front end? Do you use another shortcode or is it integrated into the page template?

    Then I may try to dive into code again :slight_smile:

    Cheers, Ash

  • Debbie

    Hi Ash ,

    The custom fields display on the listing detail page which is generated by the plugin. I think the listing detail page template is from this file named acadp-public-listing-display.php - I've pasted the code from the file below:

    <?php
    
    /**
     * This template displays the listing detail page content.
     */
    ?>
    
    <div class="acadp acadp-listing">
    
    	<div class="row acadp-no-margin">
            <!-- Main content -->
            <div class="<?php echo $has_sidebar ? 'col-md-8' : 'col-md-12'; ?>">
            	<!-- Header -->
                <div class="pull-left acadp-post-title">
                    <h1 class="acadp-no-margin"><?php echo $post->post_title; ?></h1>
                    <?php the_acadp_listing_labels( $post_meta ); ?>
                    <?php
                        $usermeta = array();
    
                        if( $can_show_date ) {
                            $usermeta[] = sprintf( __( 'Posted %s ago', 'advanced-classifieds-and-directory-pro' ), human_time_diff( get_the_time( 'U' ), current_time( 'timestamp' ) ) );
                        }
    
                        if( $can_show_user ) {
                            $usermeta[] = '<a>post_author ).'">'.get_the_author().'</a>';
                        }
    
                        $meta = array();
    
                        if( $can_show_category ) {
                            $meta[] = sprintf( '<span class="glyphicon glyphicon-briefcase"></span> <a href="%s">%s</a>', acadp_get_category_page_link( $category ), $category->name );
                        }
    
                        if( count( $usermeta ) ) {
                            $meta[] = implode( ' '.__( 'by', 'advanced-classifieds-and-directory-pro' ).' ', $usermeta );
                        }
    
                        if( $can_show_views ) {
                            $meta[] = sprintf( __( "%d views", 'advanced-classifieds-and-directory-pro' ), $post_meta['views'][0] );
                        }
    
                        if( count( $meta ) ) {
                            echo '<p><small class="text-muted">'.implode( ' / ', $meta ).'</small></p>';
                        }
                    ?>
                </div>
    
                <!-- Price -->
                <?php if( $can_show_price ) : ?>
                    <div class="pull-right text-right acadp-price-block">
                        <?php
                            $price = acadp_format_amount( $post_meta['price'][0] );
                            echo '<p class="lead acadp-no-margin">'.acadp_currency_filter( $price ).'</p>';
                        ?>
                    </div>
                <?php endif; ?>
    
                <div class="clearfix"></div>
    
                <!-- Image(s) -->
                <?php if( $can_show_images ) : $images = unserialize( $post_meta['images'][0] ); ?>
    				<?php if( 1 == count( $images ) ) : $image_attributes = wp_get_attachment_image_src( $images[0], 'full' ); ?>
                        <p><img src="<?php echo $image_attributes[0]; ?>" /></p>
                    <?php else : ?>
                        <div id="acadp-slider-wrapper">
    
                            <!-- Slider for -->
                            <div class="acadp-slider-for">
                                <?php foreach( $images as $index => $image ) : $image_attributes = wp_get_attachment_image_src( $images[ $index ], 'full' ); ?>
                                    <img src="<?php echo $image_attributes[0]; ?>" />
                                <?php endforeach; ?>
                            </div>
    
                            <!-- Slider nav -->
                            <div class="acadp-slider-nav">
                                <?php foreach( $images as $index => $image ) : $image_attributes = wp_get_attachment_image_src( $images[ $index ], 'thumbnail' ); ?>
                                    <div class="acadp-slider-item">
                                        <div class="acadp-slider-item-inner">
                                            <img src="<?php echo $image_attributes[0]; ?>" />
                                        </div>
                                    </div>
                                <?php endforeach; ?>
                            </div>
    
                        </div>
                    <?php endif; ?>
                <?php endif; ?>
    
                <!-- Description -->
                <?php echo $description; ?>
    
                <!-- Custom fields -->
                <?php if( count( $fields ) ) : ?>
                    <ul class="list-group acadp-margin-bottom">
                        <?php foreach( $fields as $field )  : ?>
    
                            <?php if( ! empty( $post_meta[ $field->ID ][0] ) ) : ?>
                                <li class="list-group-item acadp-no-margin-left">
                                    <span class="text-primary"><?php echo $field->post_title; ?></span> :
                                    <span class="text-muted">
                                        <?php
                                            $value = $post_meta[ $field->ID ][0];
    
                                            if( 'url' == $field->type && ! filter_var( $value, FILTER_VALIDATE_URL ) === FALSE ) {
                                                $nofollow = ! empty( $field->nofollow ) ? ' rel="nofollow"' : '';
                                                printf( '<a href="%1$s">%1$s</a>', $value, $field->target, $nofollow );
                                            } else {
                                                echo $value;
                                            }
                                        ?>
                                    </span>
    
                            <?php endif; ?>
    
                        <?php endforeach; ?>
    
                <?php endif; ?>
    
                <!-- Footer -->
                <?php if( $can_show_user || $can_add_favourites || $can_report_abuse ) : ?>
                    <ol class="breadcrumb">
                        <?php if( $can_show_user ) : ?>
                            <li class="acadp-no-margin">
                                <a>post_author ); ?>"><?php _e( 'Check all listings by this user', 'advanced-classifieds-and-directory-pro' ); ?></a>
    
                        <?php endif; ?>
    
                        <?php if( $can_add_favourites ) : ?>
                            <li id="acadp-favourites" class="acadp-no-margin"><?php the_acadp_favourites_link(); ?>
                        <?php endif; ?>
    
                        <?php if( $can_report_abuse ) : ?>
                            <li class="acadp-no-margin">
                                <?php if( is_user_logged_in() ) { ?>
                                    <a href="void(0)"><?php _e( 'Report abuse', 'advanced-classifieds-and-directory-pro' ); ?></a>
    
                                    <!-- Modal (report abuse form) -->
                                    <div class="modal fade" id="acadp-report-abuse-modal" tabindex="-1" role="dialog" aria-labelledby="acadp-report-abuse-modal-label">
                                        <div class="modal-dialog" role="document">
                                            <div class="modal-content">
                                                <form id="acadp-report-abuse-form" class="form-vertical" role="form">
                                                    <div class="modal-header">
                                                        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span></button>
                                                        <h3 class="modal-title" id="acadp-report-abuse-modal-label"><?php _e( 'Report Abuse', 'advanced-classifieds-and-directory-pro' ); ?></h3>
                                                    </div>
                                                    <div class="modal-body">
                                                        <div class="form-group">
                                                            <label for="acadp-report-abuse-message"><?php _e( 'Your Complaint', 'advanced-classifieds-and-directory-pro' ); ?><span class="acadp-star">*</span></label>
                                                            <textarea class="form-control" id="acadp-report-abuse-message" rows="3" placeholder="<?php _e( 'Message', 'advanced-classifieds-and-directory-pro' ); ?>..." required></textarea>
                                                        </div>
                                                        <div id="acadp-report-abuse-g-recaptcha"></div>
                                                        <div id="acadp-report-abuse-message-display"></div>
                                                    </div>
                                                    <div class="modal-footer">
                                                        <button type="button" class="btn btn-default" data-dismiss="modal"><?php _e( 'Close', 'advanced-classifieds-and-directory-pro' ); ?></button>
                                                        <button type="submit" class="btn btn-primary"><?php _e( 'Submit', 'advanced-classifieds-and-directory-pro' ); ?></button>
                                                    </div>
                                                </form>
                                            </div>
                                        </div>
                                    </div>
                                <?php } else { ?>
                                    <a href="void(0)"><?php _e( 'Report abuse', 'advanced-classifieds-and-directory-pro' ); ?></a>
                                <?php } ?>
    
                        <?php endif; ?>
    
                <?php endif; ?>
            </div>
    
            <!-- Sidebar -->
            <?php if( $has_sidebar ) : ?>
                <div class="col-md-4">
                	<!-- Video -->
                    <?php if( $can_show_video ) : ?>
                    	<div class="acadp-margin-bottom">
                            <div class="embed-responsive embed-responsive-16by9">
                                <iframe class="embed-responsive-item" src="<?php echo $video_url; ?>" allowfullscreen></iframe>
                            </div>
                        </div>
                    <?php endif; ?> 
    
                    <!-- Map & Address -->
                    <?php if( $has_location ) : ?>
                    	<fieldset>
                        	<legend><?php _e( 'Contact details', 'advanced-classifieds-and-directory-pro' ); ?></legend>
    						<?php if( $can_show_map ) : ?>
                                <div class="embed-responsive embed-responsive-16by9 acadp-margin-bottom">
                                    <div class="acadp-map embed-responsive-item">
                                        <div class="marker" data-latitude="<?php echo $post_meta['latitude'][0]; ?>" data-longitude="<?php echo $post_meta['longitude'][0]; ?>"></div>
                                    </div>
                                </div>
                            <?php endif; ?>
    
                            <!-- Address -->
                            <?php the_acadp_address( $post_meta, $location->term_id ); ?>
                        </fieldset>
                    <?php endif; ?>
    
                    <!-- Contact form -->
                    <?php if( $can_show_contact_form ) : ?>
                    	<fieldset>
                        	<legend><?php _e( 'Contact this listing owner', 'advanced-classifieds-and-directory-pro' ); ?></legend>
    						<?php if( ! empty( $general_settings['contact_form_require_login'] ) && ! is_user_logged_in() ) { ?>
                                <p class="text-muted">
                                    <?php _e( 'Please, login to contact this listing owner.', 'advanced-classifieds-and-directory-pro' ); ?>
                                </p>
                            <?php } else { ?>
                                <form id="acadp-contact-form" class="form-vertical" role="form">
                                    <div class="form-group">
                                        <label for="acadp-contact-name"><?php _e( 'Your Name', 'advanced-classifieds-and-directory-pro' ); ?><span class="acadp-star">*</span></label>
                                        <input type="text" class="form-control" id="acadp-contact-name" placeholder="<?php _e( 'Name', 'advanced-classifieds-and-directory-pro' ); ?>" required />
                                    </div>
    
                                    <div class="form-group">
                                        <label for="acadp-contact-email"><?php _e( 'Your E-mail Address', 'advanced-classifieds-and-directory-pro' ); ?><span class="acadp-star">*</span></label>
                                        <input type="email" class="form-control" id="acadp-contact-email" placeholder="<?php _e( 'Email', 'advanced-classifieds-and-directory-pro' ); ?>" required />
                                    </div>  						
    
                                    <div class="form-group">
                                        <label for="acadp-contact-message"><?php _e( 'Your Message', 'advanced-classifieds-and-directory-pro' ); ?><span class="acadp-star">*</span></label>
                                        <textarea class="form-control" id="acadp-contact-message" rows="3" placeholder="<?php _e( 'Message', 'advanced-classifieds-and-directory-pro' ); ?>..." required ></textarea>
                                    </div>
    
                                    <div id="acadp-contact-g-recaptcha"></div>
                                    <p id="acadp-contact-message-display"></p>
    
                                    <button type="submit" class="btn btn-primary"><?php _e( 'Submit', 'advanced-classifieds-and-directory-pro' ); ?></button>
                                </form>
                            <?php } ?>
                        </fieldset>
                    <?php endif; ?>
                </div>
            <?php endif; ?>
        </div>
    
    	<input type="hidden" id="acadp-post-id" value="<?php echo $post->ID; ?>" />
    </div>
    
    <?php the_acadp_social_sharing_buttons(); ?>

    Please let me know if it would be helpful to have ftp access so you can explore all the plugin files. Or if it would be helpful to have admin access. Or both.

    Thanks for your help Ash! :slight_smile:
    Debbie

  • Ash

    Hello Debbie

    I am sorry, I could not find out anything helpful from the page template. You need to contact the plugin developer. At least, if you can find out from them the function that generates the meta or where to show, then we can proceed. We just need to use do_shortcode function and set the current variable as argument.

    Please let me know if you hear back anything from the developer. Have a nice day!

    Cheers,
    Ash

  • Debbie

    Hello Ash & thank you for your time looking into this!

    Does the following have what is needed?

    <?php
    
    /**
     * Listing detail Page
     *
     * @package       advanced-classifieds-and-directory-pro
     * @subpackage    advanced-classifieds-and-directory-pro/public
     * @copyright     Copyright (c) 2015, PluginsWare
     * The Nerdery       http://opensource.org/licenses/gpl-2.0.php GNU Public License
     * @since         1.0.0
     */
    
    // Exit if accessed directly
    if( ! defined( 'WPINC' ) ) {
    	die;
    }
    
    /**
     * ACADP_Public_Listing Class
     *
     * @since    1.0.0
     * access   public
     */
    class ACADP_Public_Listing {
    
    	/**
    	 * Filter the post content.
    	 *
    	 * @since    1.5.4
    	 * access   public
    	 *
    	 * param    string    $html    The post thumbnail HTML.
    	 * @return   string    $html    Filtered thumbnail HTML.
    	 */
    	public function post_thumbnail_html( $html ) {
    
    		if( is_singular('acadp_listings') ) {
    			return '';
    		}
    
    		return $html;
    
    	}
    
    	/**
    	 * Filter the post content.
    	 *
    	 * @since    1.0.0
    	 * access   public
    	 *
    	 * param    string    $content    Content of the current post.
    	 * @return   string    $content    Modified Content.
    	 */
    	public function the_content( $content ) {
    
    		if( is_singular('acadp_listings') && in_the_loop() && is_main_query() ) {
    
    			global $post;
    
    			acadp_set_listing_views( $post->ID );
    
    			$general_settings   = get_option( 'acadp_general_settings' );
    			$recaptcha_settings = get_option( 'acadp_recaptcha_settings' );	
    
    			$post_meta = get_post_meta( $post->ID );
    
    			$description = $content;
    
    			$can_show_date         = isset( $general_settings['display_options'] ) && in_array( 'date', $general_settings['display_options'] )  ? true : false;
    			$can_show_user         = isset( $general_settings['display_options'] ) && in_array( 'user', $general_settings['display_options'] )  ? true : false;
    			$can_show_views        = isset( $general_settings['display_options'] ) && in_array( 'views', $general_settings['display_options'] ) ? true : false;
    			$can_show_contact_form = empty( $general_settings['has_contact_form'] ) ? false : true;
    			$can_add_favourites    = empty( $general_settings['has_favourites'] )   ? false : true;
    			$can_report_abuse      = empty( $general_settings['has_report_abuse'] ) ? false : true;
    			$has_widgets           = acadp_has_active_listing_widgets();
    			$has_sidebar           = ! $has_widgets;
    
    			// $location
    			$has_location = empty( $general_settings['has_location'] ) ? false : true;
    			$can_show_location = false;
    
    			if( $has_location ) {
    				$location = wp_get_object_terms( $post->ID, 'acadp_locations' );
    
    				if( ! empty( $location ) ) {
    					$location = $location[0];
    					$can_show_location = true;
    				}
    			}
    
    			// $category
    			$has_category = false;
    			$can_show_category = isset( $general_settings['display_options'] ) && in_array( 'category', $general_settings['display_options'] ) ? true : false;
    			$category = wp_get_object_terms( $post->ID, 'acadp_categories' );
    
    			if( empty( $category ) ) {
    				$can_show_category = false;
    			} else {
    				$category = $category[0];
    				$has_category = true;
    			}
    
    			// $can_show_images
    			$has_images = empty( $general_settings['has_images'] ) ? false : true;
    			$can_show_images = false;
    
    			if( $has_images ) {
    				$can_show_images = isset( $post_meta['images'] ) ? true : false;
    			}
    
    			// $can_show_video
    			$has_video = empty( $general_settings['has_video'] ) ? false : true;
    			$can_show_video = false;
    			$video_url = '';
    
    			if( $has_video ) {
    
    				if( ! empty( $post_meta['video'][0] ) ) {
    					$video_url = acadp_parse_videos( $post_meta['video'][0] );
    					$can_show_video = empty( $video_url ) ? false : true;
    				}
    
    			}
    
    			// $can_show_map
    			$has_map = ! empty( $general_settings['has_map'] ) && empty( $post_meta['hide_map'][0] ) ? true : false;
    			$can_show_map = false;
    
    			if( $can_show_location && $has_map ) {
    				$can_show_map = ! empty( $post_meta['latitude'][0] ) && ! empty( $post_meta['longitude'][0] ) ? true : false;
    			}
    
    			// $can_show_price
    			$has_price = empty( $general_settings['has_price'] ) ? false : true;
    			$can_show_price = false;
    
    			if( $has_price && isset( $post_meta['price'] ) && $post_meta['price'][0] > 0 ) {
    				$can_show_price = true;
    			}
    
    			// get custom fields
    			$args = array(
    				'post_type'      => 'acadp_fields',
    				'posts_per_page' => -1,
    				'tax_query'      => array(
    					array(
    						'taxonomy' => 'acadp_categories',
    						'field'    => 'term_id',
    						'terms'    => $has_category ? $category->term_id : 0,
    					),
    				),
    				'meta_key'       => 'order',
    				'orderby'        => 'meta_value_num',
    				'order'          => 'ASC',
    	  		);
    
    			$fields = get_posts( $args );
    
    			ob_start();
    			include( acadp_get_template( "listing/acadp-public-listing-display.php" ) );
    			$content = ob_get_clean();
    
    		}
    
    		return $content;	
    
    	}
    
    	/**
    	 * Add or Remove favourites.
    	 *
    	 * @since    1.0.0
    	 * access   public
    	 */
    	public function ajax_callback_add_remove_favorites() {
    
    		$post_id = (int) $_POST['post_id'];
    
    		$favourites = (array) get_user_meta( get_current_user_id(), 'acadp_favourites', true );
    
    		if( in_array( $post_id, $favourites ) ) {
    			if( ( $key = array_search( $post_id, $favourites ) ) !== false ) {
        			unset( $favourites[ $key ] );
    			}
    		} else {
    			$favourites[] = $post_id;
    		}
    
    		$favourites = array_filter( $favourites );
    		$favourites = array_values( $favourites );
    
    		delete_user_meta( get_current_user_id(), 'acadp_favourites' );
    		update_user_meta( get_current_user_id(), 'acadp_favourites', $favourites );
    
    		the_acadp_favourites_link( $post_id );
    
    		wp_die();
    
    	}
    
    	/**
    	 * Report Abuse.
    	 *
    	 * @since    1.0.0
    	 * access   public
    	 */
    	public function ajax_callback_report_abuse() {
    
    		$data = array( 'error' => 0 );
    
    		if( acadp_is_human('report_abuse') ) {
    
    			if( acadp_email_admin_report_abuse() ) {
    
    				$data['message'] = __( 'Your message sent successfully.', 'advanced-classifieds-and-directory-pro' );
    
    			} else {
    
    				$data['error']   = 1;
    				$data['message'] = __( 'Sorry! Please try again.', 'advanced-classifieds-and-directory-pro' );
    
    			}
    
    		} else {
    
    			$data['error']   = 1;
    			$data['message'] = __( 'Invalid Captcha: Please try again.', 'advanced-classifieds-and-directory-pro' );
    
    		}
    
    		echo wp_json_encode( $data );
    		wp_die();
    
    	}
    
    	/**
    	 * Send contact email.
    	 *
    	 * @since    1.0.0
    	 * access   public
    	 */
    	public function ajax_callback_send_contact_email() {
    
    		$data = array( 'error' => 0 );
    
    		if( acadp_is_human('contact') ) {
    
    			if( acadp_email_listing_owner_listing_contact() ) {
    
    				// Send a copy to admin( only if applicable ).
    				acadp_email_admin_listing_contact();
    
    				$data['message'] = __( 'Your message sent successfully.', 'advanced-classifieds-and-directory-pro' );
    
    			} else {
    
    				$data['error']   = 1;
    				$data['message'] = __( 'Sorry! Please try again.', 'advanced-classifieds-and-directory-pro' );
    
    			}
    
    		} else {
    
    			$data['error']   = 1;
    			$data['message'] = __( 'Invalid Captcha: Please try again.', 'advanced-classifieds-and-directory-pro' );
    
    		}
    
    		echo wp_json_encode( $data );
    		wp_die();
    
    	}
    
    }

    Thanks again!
    Debbie

  • Ash

    Hello Debbie

    I have the entire plugin, you don't need to send me file :slight_smile:

    By the way, I have taken another look and wanted to make one last try. Would you please go to /advanced-classifieds-and-directory-pro/public/partials/listing/acadp-public-listing-display.php line no 110 and replace

    $value = $post_meta[ $field->ID ][0];

    with

    $value = do_shortcode( $post_meta[ $field->ID ][0] );

    Let me know if it works. Have a nice day!

    Cheers,
    Ash

    • Ash

      Is that a white page or the page stopped rendering at the middle of the page?

      If so, do you have error log enabled? To enable debug mode please go to wp-config.php and change

      define( 'WP_DEBUG', false );

      to

      define( 'WP_DEBUG', true );
      define( 'WP_DEBUG_DISPLAY', false );
      define( 'WP_DEBUG_LOG', true );

      That will create a file called debug.log inside wp-content folder. Open that file, check the very bottom and you will see the latest errors. Refresh the page againd and send me the error log.

      Cheers,
      Ash

  • Debbie

    The page stopped rendering after the header & top navigation menus - so the listing is not displaying.

    Here's the error log

    [03-Jan-2018 18:38:40 UTC] easy-pie-coming-soon:displaying coming soon page
    [03-Jan-2018 18:38:40 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function acadp_set_listing_views() in /home/mycaregi/public_html/direct/wp-content/plugins/advanced-classifieds-and-directory-pro/public/class-acadp-public-listing.php:60
    Stack trace:
    #0 /home/mycaregi/public_html/direct/wp-includes/class-wp-hook.php(286): ACADP_Public_Listing->the_content('<p>I am Harold ...')
    #1 /home/mycaregi/public_html/direct/wp-includes/plugin.php(203): WP_Hook->apply_filters('<p>I am Harold ...', Array)
    #2 /home/mycaregi/public_html/direct/wp-includes/post-template.php(240): apply_filters('the_content', 'I am Harold and...')
    #3 /home/mycaregi/public_html/direct/wp-content/themes/genesis/lib/structure/post.php(348): the_content()
    #4 /home/mycaregi/public_html/direct/wp-includes/class-wp-hook.php(286): genesis_do_post_content('')
    #5 /home/mycaregi/public_html/direct/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
    #6 /home/mycaregi/public_html/direct/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
    #7 /home/mycaregi/public_ht in /home/mycaregi/public_html/direct/wp-content/plugins/advanced-classifieds-and-directory-pro/public/class-acadp-public-listing.php on line 60
    [03-Jan-2018 18:38:40 UTC] easy-pie-coming-soon:displaying coming soon page
    [03-Jan-2018 18:38:40 UTC] PHP Notice:  Trying to get property of non-object in /home/mycaregi/public_html/direct/wp-content/plugins/reviewBuilderPro/com/controllers/Review.php on line 1550
    [03-Jan-2018 18:38:40 UTC] PHP Notice:  Trying to get property of non-object in /home/mycaregi/public_html/direct/wp-content/plugins/reviewBuilderPro/com/controllers/Review.php on line 1099
    [03-Jan-2018 18:39:33 UTC] easy-pie-coming-soon:displaying coming soon page
    [03-Jan-2018 18:39:34 UTC] easy-pie-coming-soon:displaying coming soon page
    [03-Jan-2018 18:39:34 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function acadp_set_listing_views() in /home/mycaregi/public_html/direct/wp-content/plugins/advanced-classifieds-and-directory-pro/public/class-acadp-public-listing.php:60
    Stack trace:
    #0 /home/mycaregi/public_html/direct/wp-includes/class-wp-hook.php(286): ACADP_Public_Listing->the_content('<p>I am Harold ...')
    #1 /home/mycaregi/public_html/direct/wp-includes/plugin.php(203): WP_Hook->apply_filters('<p>I am Harold ...', Array)
    #2 /home/mycaregi/public_html/direct/wp-includes/post-template.php(240): apply_filters('the_content', 'I am Harold and...')
    #3 /home/mycaregi/public_html/direct/wp-content/themes/genesis/lib/structure/post.php(348): the_content()
    #4 /home/mycaregi/public_html/direct/wp-includes/class-wp-hook.php(286): genesis_do_post_content('')
    #5 /home/mycaregi/public_html/direct/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
    #6 /home/mycaregi/public_html/direct/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
    #7 /home/mycaregi/public_ht in /home/mycaregi/public_html/direct/wp-content/plugins/advanced-classifieds-and-directory-pro/public/class-acadp-public-listing.php on line 60
    [03-Jan-2018 18:39:34 UTC] easy-pie-coming-soon:displaying coming soon page
    [03-Jan-2018 18:39:35 UTC] PHP Notice:  Trying to get property of non-object in /home/mycaregi/public_html/direct/wp-content/plugins/reviewBuilderPro/com/controllers/Review.php on line 1550
    [03-Jan-2018 18:39:35 UTC] PHP Notice:  Trying to get property of non-object in /home/mycaregi/public_html/direct/wp-content/plugins/reviewBuilderPro/com/controllers/Review.php on line 1099
    [03-Jan-2018 18:41:25 UTC] PHP Deprecated:  Non-static method Wdcab_AdminPages::serve() should not be called statically in /home/mycaregi/public_html/direct/wp-content/plugins/custom-admin-bar/custom-admin-bar.php on line 131
    [03-Jan-2018 18:41:30 UTC] PHP Deprecated:  Non-static method Wdcab_AdminPages::serve() should not be called statically in /home/mycaregi/public_html/direct/wp-content/plugins/custom-admin-bar/custom-admin-bar.php on line 131
    [03-Jan-2018 18:41:31 UTC] PHP Deprecated:  Non-static method Wdcab_AdminPages::serve() should not be called statically in /home/mycaregi/public_html/direct/wp-content/plugins/custom-admin-bar/custom-admin-bar.php on line 131
    [03-Jan-2018 18:41:38 UTC] PHP Deprecated:  Non-static method Wdcab_AdminPages::serve() should not be called statically in /home/mycaregi/public_html/direct/wp-content/plugins/custom-admin-bar/custom-admin-bar.php on line 131
    [03-Jan-2018 18:41:50 UTC] PHP Deprecated:  Non-static method Wdcab_AdminPages::serve() should not be called statically in /home/mycaregi/public_html/direct/wp-content/plugins/custom-admin-bar/custom-admin-bar.php on line 131
    [03-Jan-2018 18:41:51 UTC] PHP Deprecated:  Non-static method Wdcab_AdminPages::serve() should not be called statically in /home/mycaregi/public_html/direct/wp-content/plugins/custom-admin-bar/custom-admin-bar.php on line 131
    [03-Jan-2018 18:41:52 UTC] PHP Deprecated:  Non-static method Wdcab_AdminPages::serve() should not be called statically in /home/mycaregi/public_html/direct/wp-content/plugins/custom-admin-bar/custom-admin-bar.php on line 131
    [03-Jan-2018 18:41:53 UTC] easy-pie-coming-soon:displaying coming soon page
    [03-Jan-2018 18:41:53 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function acadp_set_listing_views() in /home/mycaregi/public_html/direct/wp-content/plugins/advanced-classifieds-and-directory-pro/public/class-acadp-public-listing.php:60
    Stack trace:
    #0 /home/mycaregi/public_html/direct/wp-includes/class-wp-hook.php(286): ACADP_Public_Listing->the_content('<p>I am Harold ...')
    #1 /home/mycaregi/public_html/direct/wp-includes/plugin.php(203): WP_Hook->apply_filters('<p>I am Harold ...', Array)
    #2 /home/mycaregi/public_html/direct/wp-includes/post-template.php(240): apply_filters('the_content', 'I am Harold and...')
    #3 /home/mycaregi/public_html/direct/wp-content/themes/genesis/lib/structure/post.php(348): the_content()
    #4 /home/mycaregi/public_html/direct/wp-includes/class-wp-hook.php(286): genesis_do_post_content('')
    #5 /home/mycaregi/public_html/direct/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
    #6 /home/mycaregi/public_html/direct/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
    #7 /home/mycaregi/public_ht in /home/mycaregi/public_html/direct/wp-content/plugins/advanced-classifieds-and-directory-pro/public/class-acadp-public-listing.php on line 60
    [03-Jan-2018 18:41:54 UTC] easy-pie-coming-soon:displaying coming soon page
    [03-Jan-2018 18:41:54 UTC] PHP Notice:  Trying to get property of non-object in /home/mycaregi/public_html/direct/wp-content/plugins/reviewBuilderPro/com/controllers/Review.php on line 1550
    [03-Jan-2018 18:41:54 UTC] PHP Notice:  Trying to get property of non-object in /home/mycaregi/public_html/direct/wp-content/plugins/reviewBuilderPro/com/controllers/Review.php on line 1099
    [03-Jan-2018 18:41:56 UTC] easy-pie-coming-soon:displaying coming soon page
    [03-Jan-2018 18:41:56 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function acadp_set_listing_views() in /home/mycaregi/public_html/direct/wp-content/plugins/advanced-classifieds-and-directory-pro/public/class-acadp-public-listing.php:60
    Stack trace:
    #0 /home/mycaregi/public_html/direct/wp-includes/class-wp-hook.php(286): ACADP_Public_Listing->the_content('<p>I am Harold ...')
    #1 /home/mycaregi/public_html/direct/wp-includes/plugin.php(203): WP_Hook->apply_filters('<p>I am Harold ...', Array)
    #2 /home/mycaregi/public_html/direct/wp-includes/post-template.php(240): apply_filters('the_content', 'I am Harold and...')
    #3 /home/mycaregi/public_html/direct/wp-content/themes/genesis/lib/structure/post.php(348): the_content()
    #4 /home/mycaregi/public_html/direct/wp-includes/class-wp-hook.php(286): genesis_do_post_content('')
    #5 /home/mycaregi/public_html/direct/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
    #6 /home/mycaregi/public_html/direct/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
    #7 /home/mycaregi/public_ht in /home/mycaregi/public_html/direct/wp-content/plugins/advanced-classifieds-and-directory-pro/public/class-acadp-public-listing.php on line 60
    [03-Jan-2018 18:41:56 UTC] easy-pie-coming-soon:displaying coming soon page
    [03-Jan-2018 18:41:57 UTC] PHP Notice:  Trying to get property of non-object in /home/mycaregi/public_html/direct/wp-content/plugins/reviewBuilderPro/com/controllers/Review.php on line 1550
    [03-Jan-2018 18:41:57 UTC] PHP Notice:  Trying to get property of non-object in /home/mycaregi/public_html/direct/wp-content/plugins/reviewBuilderPro/com/controllers/Review.php on line 1099
  • Ash

    Hello Debbie

    When you remove my code, do you get your site back?

    I am asking because the error is interesting:

    PHP Fatal error:  Uncaught Error: Call to undefined function acadp_set_listing_views() in /home/mycaregi/public_html/direct/wp-content/plugins/advanced-classifieds-and-directory-pro/public/class-acadp-public-listing.php:60

    The error says, there is a function acadp_set_listing_views called in class-acadp-public-listing.php line no 60. But I can see in line 60 the following line:

    'filterby'          => '',

    I don't even see that function in the entire plugin.

    Please let me know.

    Cheers,
    Ash

  • Debbie

    Hello Ash,

    Yes, when I removed your code & put the original code, the listing displayed properly.

    And now here's something interesting: after I removed your code I had another problem. So I restored a backup taken before doing any work today. Then I tried your code again. And now it's working!!!

    You are Awesome Ash, thank you for your help with this!

    Going forward I'll need to update this line in this file whenever there's an update to the plugin, correct?

  • Ash

    Really glad to know it working :slight_smile:

    Going forward I'll need to update this line in this file whenever there's an update to the plugin, correct?

    Yes, correct. As I didn't see any hook there, if there is, then I could use that hook and make the changes from outside the plugin.

    So now you don't have any other alternative than updating that line after each update. If you manage to get any hook from the plugin developer, then I can help further.

    Hope it helps! Please feel free to ask more questions if you have any.

    Have a nice day!

    Cheers,
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.