Remove Price Tag for ads without a price or ZERO (0)
Hello all ClassiPress admins,
Sometimes we don't need a price tag to show up at all. That could be listings for Relationships, Datings, Job offers, Information ads, Free give aways, etc etc...
And to see a short and empty price tag is also not nice. So let's remove that price tag when it's not needed. I give you two options to get this job done:
Option 1: You are running a child theme and got a functions.php?
Open that functions.php and add the following code:
Code:
// Unhook default ClassiPress functions
function unhook_classipress_functions() {
remove_action( 'appthemes_before_post_title', 'cp_ad_loop_price' );
}
add_action('init','unhook_classipress_functions');
function cp_remove_loop_price() {
if ( is_page() ) return; // don't do ad-meta on pages
global $post;
if ( $post->post_type == 'page' || $post->post_type == 'post' ) return;
$price = get_post_meta($post->ID, 'cp_price', true);
if (!empty($price) AND ($price>0)){
?>
<div class="price-wrap">
<span class="tag-head"> </span><p class="post-price">
<?php if ( get_post_meta( $post->ID, 'price', true ) ) cp_get_price_legacy( $post->ID );
else cp_get_price( $post->ID, 'cp_price' ); ?></p>
</div>
<?php
} else { ?>
<?php
}
}
add_action( 'appthemes_before_post_title', 'cp_remove_loop_price' );
Option 2: You don't have a child theme and you are to lazy to modify files:
Install it as a free plugin (download the remove-price-tag.zip attachment)