- This topic has 17 replies, 5 voices, and was last updated 4 years, 8 months ago by David.
-
AuthorPosts
-
June 6, 2017 at 12:23 am #329170Fulvio
i need to insert a short code in the file content-single.php for adding a post rating.
i tried to insert the shortcode in the php file but don’t take effect.
is possible to add shortcode in php file? if not, there is another solution?
actually i put the rating using a base html formatting and the php code for call the plugin rating
you can see it below the autorbox.http://new.sarao.it/fonti-di-traffico-clienti-per-ecommerce/
but i want to make a background color and other formattingthanks a lot
FulvioJune 6, 2017 at 12:29 am #329172Fulviosorry,
I forgot to add a specific.I add this but don’t take effect too:
<?php if ( is_single() ) { ?> [elementor-template id="16040"] <?php } ?>
June 6, 2017 at 5:48 am #329285DavidStaffCustomer SupportHi Fulvio,
try replacing shortcode with:
echo do_shortcode("[elementor-template id='16040']");
David
June 6, 2017 at 6:01 am #329299Fulvioi tried inserting the code it in the php file but notthing
<?php if ( is_single() ) { ?> echo do_shortcode("[elementor-template id='16040']"); <?php } ?>
i make a test and i put anly the code you gave me:
echo do_shortcode("[elementor-template id='16040']");
but no way to obtayn somethingJune 6, 2017 at 7:07 am #329335DavidStaffCustomer SupportHi Fulvio,
i would suggest reading Tom’s guide on adding php
Its not recommended to edit php directly.
Also read about using hooks as this might be an easier way to add the content.
Sorry i cant be much more help – Tom and Leo are the experts!
June 6, 2017 at 7:21 am #329342Fulviothanks david, i read the 2 article, but seams are very poor of information, i try to study how make this hooks
thanksJune 6, 2017 at 8:32 am #329368DavidStaffCustomer SupportHi Fulvio
try adding YOUR original code to the After Content GP Hook.
The GP Hook’s are found under the Appearance menu on your dashboard.June 6, 2017 at 8:47 am #329379TomLead DeveloperLead DeveloperYour code would look like this:
<?php if ( is_single() ) { echo do_shortcode("[elementor-template id='16040']"); } ?>
Definitely use GP Hooks instead of altering core files.
June 7, 2017 at 6:37 pm #330227NickHey Tom,
Any way to combine the technique you outline here (https://generatepress.com/forums/topic/adding-a-button-to-menu-workaround/#post-109155) with an Elementor shortcode. So one could design the button (or social icons or whatever) using Elementor, and then insert it in the same way that you showed in that other thread.
This forum truly is awesome. I almost always find what I’m looking for π
June 7, 2017 at 11:52 pm #330306TomLead DeveloperLead DeveloperHmm, I’m not sure that would be possible unless Elementor itself can create the shortcode?
It’s a little advanced, but you could design the button in Elementor and then copy the HTML/CSS and use it elsewhere?
June 8, 2017 at 6:48 am #330454Fulvio<?php if ( is_single() ) { echo do_shortcode("[elementor-template id='16040']"); } ?>
this solved my request.
Thanks a lot to allJune 8, 2017 at 1:46 pm #330690TomLead DeveloperLead DeveloperGlad we could help π
June 8, 2017 at 1:50 pm #330692NickHey Tom,
So instead of this:
<a class="my-custom-button" href="button URL">Button text</a>
is it not possible to add one of the Elementor shortcodes, somehow:
[elementor-template id='16040']
Wanted to make sure you were clear on what I was referring to π
It would be amazing to design something in Elementor and be able to add it to the navigation menu using the add_action. I’d considered designing it then using the html/css, but I haven’t looked into how easy that would be.
Thanks!
June 8, 2017 at 4:24 pm #330750TomLead DeveloperLead DeveloperI don’t think that would be do-able, unless that elementor template was only a button.. Worth a try though?
Might be overkill just for a simple button.
June 8, 2017 at 4:43 pm #330757NickYeah, my only thought is that Elementor makes it so easy to design buttons and icons. I can make my way through with CSS but if I can get away without it, I thought I’d try.
Thanks Tom!
-
AuthorPosts
- You must be logged in to reply to this topic.