Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (! defined( 'ABSPATH') ){
- exit;
- }
- add_filter('ampforwp_pb_cntmod_rawhtml', 'sarah_ampforwp_pb_cntmod_rawhtml');
- function sarah_ampforwp_pb_cntmod_rawhtml($rawhtml){
- $format = get_post_format();
- $category = get_the_category();
- if(is_array($category) && count($category) > 0){
- $category = $category[0]->name;
- }
- $rawhtml = str_replace(array(
- "{{category}}",
- "{{format}}"
- ),
- array(
- $category,
- $format,
- ),
- );
- $rawhtml = ampforwp_replaceIfContentConditional("category", $category, $rawhtml);
- $rawhtml = ampforwp_replaceIfContentConditional("format", $format, $rawhtml);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement