Hi there,

We have received many questions about how to change the background color of  featured place in DirectoryEngine in order to let the users know which is standard place and which is featured place. So today, we will show you the  tip to do that.

Please follow these steps:

Step 1: Adding this following code into functions.php locates in child theme folder:

function et_add_featured_class( $classes ) {
global $post;
if( get_post_meta( $post->ID, 'et_featured', true ) == "1" ){
$classes[] = "place-featured";
}
return $classes;
}
add_filter( 'post_class', 'et_add_featured_class' );

 

Step 2: At directoryengine/js/index.js around line 39-52

  • Change:
onItemRendered: function() {
if (typeof this.model.get('page') !== 'undefined') {
this.$el.addClass('page-' + this.model.get('page'));
} else {
this.$el.addClass('page-1');
}
var view = this;
this.$('.rate-it').raty({
half: true,
score: view.model.get('rating_score'),
readOnly: true,
hints: raty.hint
});
}
  • Into:
onItemRendered: function() {
if (typeof this.model.get('page') !== 'undefined') {
this.$el.addClass('page-' + this.model.get('page'));
} else {
this.$el.addClass('page-1');
}
if(this.model.get('et_featured') == "1") this.$el.addClass('place-featured');
var view = this;
this.$('.rate-it').raty({
half: true,
score: view.model.get('rating_score'),
readOnly: true,
hints: raty.hint
});
}

 

Step 3:  Styling the featured place:

.place-featured .place-detail-wrapper {
background-color: #f0f0f0 !important;
}

 

Hope it helps!

If you have any problem while editing it, you can send a ticket via EngineThemes forum. Our technical support staff will help you solve your problem as soon as posible.

0 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.