Cost field – not showing all of text.

Home Forums Calendar Products Events Calendar PRO Cost field – not showing all of text.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1030338
    Susan
    Participant

    Prior to the latest update on the plugin I was able to type “$15.00 per month” in the ‘cost’ field and the words ‘per month’ showed on the front end of the event listing on its corresponding WP Page. Now it only say $15.00.

    I have included a screenshot here of the backend of the area I’m referring to. https://www.flickr.com/gp/137990536@N05/nr35P3

    #1030425
    Barry
    Member

    Hi Susan.

    The nature of the cost field has been changed a little and it’s not really expected to contain ‘plain text’ at this point. However, it’s certainly possible to add a small customization to restore the behaviour you are looking for:

    function cost_as_plain_text( $cost, $post_id ) {
    	return esc_html( get_post_meta( $post_id, '_EventCost', true ) );
    }
    
    add_filter( 'tribe_get_cost', 'cost_as_plain_text', 100, 2 );

    If you add the above code to a custom plugin or to your theme’s functions.php file you should be able to restore the display of text such as “$15.00 per month”.

    Does that help?

    #1030779
    Susan
    Participant

    Hi Barry,

    My developer made the change as per your note and it’s not working/showing as needed. He’s supplied this info. to me to pass onto you.
    ————————-
    I’ve added that but I don’t see any change. Can you let them know this is how we are out putting the cost in the code:

    <?php echo tribe_get_cost( null, true ) ?>

    Not sure if it makes a difference, but you may want to mention that we are using a custom template for this, it’s not “out-of-box” files. The edit is in single-event.
    ————————-
    Thanks for any further help or clues to solve this.

    Michele/Susan

    #1030802
    Barry
    Member

    I’m not sure why it wouldn’t be working for you – it certainly seems to work when I test it – but you could alternatively replace your current line of code for displaying the cost (in your custom template) with:

    echo esc_html( get_post_meta( $post_id, '_EventCost', true ) );
    #1032147
    Susan
    Participant

    That code worked perfect, thanks.

    M

    #1032623
    Barry
    Member

    Awesome 🙂

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Cost field – not showing all of text.’ is closed to new replies.