Support

Account

Home Forums General Issues Add a special global link on top of post title Reply To: Add a special global link on top of post title

  • The code I supplied will do what you are looking for, you need to add fields and then change the code to match your field names

    
    add_filter('the_title', 'wps_sponsored', 10, 2);
    function wps_sponsored($title, $post_id) {
      $sub_title = get_field('sub-title-field-name', $post_id);
      if ($sub_title) {
        $url = get_field('sub-title-url-field-name', $post_id);
        if ($url) {
          $sub_title = '<a href="'.$url.'">'.$sub_title.'</a>';
        }
        $sub_title = '<span class="subtitle">'.$sub_title.'</span>';
        $title = $sub_title.$title;
      }
      return $title;
    }