Hi @ibiza69,
you should include shortcode in the template this way:
<?php echo do_shortcode('[ratemypost]'); ?>
Hope this helps.
Blaz
Hi and thanks for the answer Blaz! We did that allready before, but as we placed that code at functions.php of the theme, the page broke, so we have to take it off.
I´m not sure if is because it has the <?php and we should take it and only place echo do_shortcode(‘[ratemypost]’);
But as we aren´t sure at all :S
Thanks for any information about this and one more thing, if we solve this at functions.php, should we place to the shortcode at the job individual listings, so starts show there?
Thanks a lot for your time ;)!
Well, we tested and addking only this at functions.php breaks too the page:
//Rate my post stars
echo do_shortcode(‘[ratemypost]’);
and this too beaks the site:
//Rate my post stars
<?php echo do_shortcode(‘[ratemypost]’); ?>
@ibiza69,
that snippet should not be placed in functions.php but in the template file – where you want the widget to be shown. Check out this thread as it is dealing with a similar issue: https://wordpress.org/support/topic/overwriting-excerpts/.
If I understand correctly, you want to show the widget in the scope of a plugin. For this it would be good to contact author of that plugin and ask if there is any hook available at the desired location. If you will make changes to plugin directly, they will be overridden after update.
Hope this was helpful.
Regards,
Blaz
PS: Just found this: https://wpjobmanager.com/document/template-overrides/
I guess you can override the template and in the override call the shortcode.
Good morning Blaz! This is what I wrote yesterday, that I placed the shortcode at wp job manager templates, as we usually do with other plugins that we need things from them and when WP Job Manager updates, we place those codes again. But with your plugin, doesn´t accept any of the codes:
<div>
[ratemypost]
</div>
or
<?php echo do_shortcode(‘[ratemypost]’); ?>
So this is why we wrote here, to see if there was a solution for this.
Any possible idea?
Thanks for your time!
@ibiza69,
so, when you include in the template
<?php echo do_shortcode(‘[ratemypost]’); ?>
nothing happens? Are you sure you are adding to the right template?
If you add
<?php echo 'Hello World'; ?>
does it display Hello World?
I don’t understand why the shortcode would not run and I haven’t encountered any similar problem in the past.
Try with “hello world” and let me know if it runs.
Regards,
Blaz
Hi Blaz, this is what we are doing at (please check your code below):
wp-content/plugins/wp-job-manager/templates/content-singles-job-listing.php
<?php
/**
* Single job listing.
*
* This template can be overridden by copying it to yourtheme/job_manager/content-single-job_listing.php.
*
* @see https://wpjobmanager.com/document/template-overrides/
* @author Automattic
* @package WP Job Manager
* @category Template
* @since 1.0.0
* @version 1.28.0
*/
if ( ! defined( ‘ABSPATH’ ) ) {
exit; // Exit if accessed directly.
}
global $post;
?>
<div class=”single_job_listing”>
<?php if ( get_option( ‘job_manager_hide_expired_content’, 1 ) && ‘expired’ === $post->post_status ) : ?>
<div class=”job-manager-info”><?php _e( ‘This listing has expired.’, ‘wp-job-manager’ ); ?></div>
<?php else : ?>
<?php
/**
* single_job_listing_start hook
*
* @hooked job_listing_meta_display – 20
* @hooked job_listing_company_display – 30
*/
do_action( ‘single_job_listing_start’ );
?>
<div class=”job_description”>
<?php wpjm_the_job_description(); ?>
</div>
<?php if ( candidates_can_apply() ) : ?>
<?php get_job_manager_template( ‘job-application.php’ ); ?>
<?php endif; ?>
<?php
/**
* single_job_listing_end hook
*/
do_action( ‘single_job_listing_end’ );
?>
<?php endif; ?>
</div>
<div>
<?php echo do_shortcode(‘[ratemypost]’); ?>
</div>
</div>
+++++++++++++++++++++++++++++++++++++
The problem is that doesn´t do anything at all.
Hi Blaz, good morning. We got thing working 😉 Thanks a lot for your help and have a nice week!
Happy to hear that @ibiza69! 🙂 Wish you a nice week too.
Regards,
Blaz