• Hi there,
    I have a plugin which looks for a specific string in the_content (by adding a filter parsing the_content) and replacing this string with e.g. a calendar.

    By using a template I would like to have that calendar shown outside of the_content-area, by using post_meta fields.

    So I placed the string for the plugin to look for in a custom-field:
    name: “calendar”, value: “<!– calendar 3 –>”

    Instead of telling the plugin to look in the_content the filter is supposed to apply when the meta-data is called:
    add_filter(‘get_post_meta’, ‘[PARSING_FUNCTION]’);
    (the parsing_function worked already without errors parsing ‘the_content’, so I guess I wont have to change a thing there)

    And in my template I was hoping to have the calendar shown when calling the specific cutom-field:
    echo get_post_meta($post->ID,’calendar_id’,true);

    Unfortunately it didnt work.

    I thought, that get_post_meta would return the value of the field ‘calendar_id’, which would then be used by the filter for checking for ‘<!– calendar 3 –>’ and if applicable replacing this with a calendar (generated by the plugin – also worked fine when adding the filter to ‘the_content’).

    Is it not possible to add a filter to ‘get_post_meta’?
    Anyone have a hint how to get this to work outside of ‘the_content’, now you know what I would like to do?

    Thank you in advance,
    Jensen

  • The topic ‘Add filter to posts metadata?’ is closed to new replies.