Support

Account

Home Forums Front-end Issues Custom Field showing on post, but not on homepage loop.(Where new post displays)

Unread

Custom Field showing on post, but not on homepage loop.(Where new post displays)

  • Hi. We have a code that is adding prefixes on all post titles with the help of ACF. The custom fields shows on single post (because it has post title) but in the homepage that displays new latest posts, it doesn’t show up even though the post have titles.

    Post https://prnt.sc/STe2SrAcFP4w
    Homepage (Where latest posts loops) https://prnt.sc/HjlDejUhqsmx

    add_action ('the_title' , 'test', 10, 2);
    function test($title, $id) {
    	 $number= get_field('number');
      return 'post' === get_post_type($id) ? $number. 'PREFIX ADDED' . $title : $title;
    }
    
    
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.