- This topic has 9 replies, 2 voices, and was last updated 6 years, 8 months ago by Tom.
-
AuthorPosts
-
July 6, 2017 at 11:35 pm #345436Fulvio
I inserted 2 line of php in Hook: After Content
<!-- inizio rating --> <?php if ( is_single() ) { echo do_shortcode("[elementor-template id='16040']"); } ?> <?php if(function_exists('the_ratings')) { the_ratings(); } ?> <!-- fine rating -->
this is for add a rating to post.
the first is a short code of elmentor, and this is visible only only in blog post
the second is the short code of wp-post rating and this is visible
but this code Is visible both in blog posts and in articles.
you can see a blog post:
https://www.sarao.it/business-model-cose-si-realizza/and this is an article:
https://www.sarao.it/progettazione-ecommerce/Or we show shorcode and rating both in posts or in articles or in post blogs, but half way does not make sense.
Do you have a solution?
Ps I have separated elmentor’s shortcode and rating because unfortunately by entering the shortcode of the rating inside the elmentor template i got an error, and I want the rating to have the box with the explanation text and the blue background color
this is what i need:
this is what i got on blog post
This is what i got on articles
July 7, 2017 at 1:03 am #345465TomLead DeveloperLead DeveloperYou might need to ask the ratings plugin author if you can display the rating using a shortcode.
Then you could add it into your Elementor library item directly, and only include the Elementor shortcode.
July 7, 2017 at 4:33 am #345513Fulvioi tried to add the shortcode in elmentor
but whit the new elmentor 1.5 i got a problem, the rating score is only one for all the posts (befoore the relize of 1.5 all was correct, but in elmentor don’t wanto to gave me suppot, they say is a plugin problem, maybe ys, but in 1.4 all was fine.Ok tom, can you suggest me where put the php code (not in hook) in whitch file and how add a div whit the backgroud color as the pic i show you.
thanks
July 7, 2017 at 9:48 am #345658TomLead DeveloperLead DeveloperIn order to place the ratings inside the blue background, they would need to exist in the library item.
Adjusting your code to show ratings on single posts only would look like this:
<!-- inizio rating --> <?php if ( is_single() ) { echo do_shortcode("[elementor-template id='16040']"); if ( function_exists( 'the_ratings' ) ) { the_ratings(); } } ?> <!-- fine rating -->
July 8, 2017 at 3:11 am #345966FulvioTom, thanks a lot for your reply.
now is visible only in blog post as I need, thanksbut the rating is out the blu elmentor template, have you any other suggestion?
thanks
FulvioJuly 8, 2017 at 10:51 am #346097TomLead DeveloperLead DeveloperIn order to get it in the Elementor template, it would have to be a shortcode that you enter into the template itself.
July 9, 2017 at 3:20 am #346339FulvioI told you, i did it, but something go wrong.
there is a possibility to add this box whitout ousing elmentor’s tempalte?
Sorry but if i insert a DIV and HTML whit beckground color and <p> i got some error or is possible?
someting like:<div=”background-color:blu;”>
<h3>This is a heading</h3>
<p>This is a paragraph.</p>July 9, 2017 at 9:33 am #346453TomLead DeveloperLead DeveloperYep, you could do this:
<div class="blue-box"> Content in here </div>
Then add CSS for it:
.blue-box { background-color: blue; color: white; padding: 15px; }
Then just update the colors.
July 10, 2017 at 5:33 am #346929FulvioThanks a lot Tom, this fix my problem.
ThanksI used this:
Css:
.rating-box { background-color: rgba(181,226,226,0.67); color: black; padding: 15px; }
Hook – after content
<!-- inizio rating --> <div class="rating-box"> <?php if ( is_single() ) { echo do_shortcode("<p><b>Vota l'Articolo</b><br> Lascia un voto da 1 a 5 stelle per indicare a chi arriverà dopo di te la qualità di questo articolo, naturalmente spero in un voto alto ;-)</p>"); if ( function_exists( 'the_ratings' ) ) { the_ratings(); } } ?> </div> <!-- fine rating -->
thanks a lot
July 10, 2017 at 9:47 am #347099TomLead DeveloperLead DeveloperAwesome! No problem 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.