mycred_parse_tags_post

Codex / mycred/log / Filters / mycred_parse_tags_post

Navigation:

  1. Description
  2. Used By
  3. Parameters
  4. Example

Description

This filter lets you add support for custom post related template tags or override the default ones.

Post related template tags are used when there is a reference to a post id allowing us to grab that posts details and build template tags like %link_with_title% which will return the permalink to the given post.

Used By

Parameters

  • content (string)
    The content containing template tags.
    Remember to always return the content once you are done!
  • post (object)
    The post object.
    Note! If the post has been deleted you will only have access to $post->ID, $post->post_title and $post->post_type.
  • data (array|string)
    If parsing the myCRED Log, the data column is passed on here. Else it will contain an empty string.

Example

Add a new template tag %post_status% which will return the given post’s current status.

add_filter( 'mycred_parse_tags_post', 'my_custom_post_template_tags', 10, 3 );
function my_custom_post_template_tags( $content, $post, $data )
{
	$content = str_replace( '%post_status%', $post->post_status, $content );
	return $content;
}

Add this code to your themes functions.php file

Last edited June 26, 2016