I am using the Google Analytics module to retrieve the most popular articles on my site during the past day to populate a 'trending' block.
The problem is that the PageTitle field comes from the meta data and includes a pipe and the site name. I would like to strip that off the end of the string, but I can't figure out how to do it within the view using rewrite results.
I created a views-view-field--pageTitle.tpl.php file and edited it to this:
<?php
$output = str_replace(" | My Site", "", $output);
print $output;
?>
this doesn't seem to work...
If you are sure it always returns it as
My Article Title | My Web Site, you could split the string at|.