Pulling my hair out - Can someone help with my Title Tag

Ok.

I have an album eg this one.

http://www.spoilertv.co.uk/images/30-rock/season-1/cast-promotional-photos/

Now at the top you can see the Album and breadcrumbs.

ie this

SpoilerTV | Photo Archive | 30 Rock | Season 1 | Cast Promotional Photos

This is all great and working dandy :)

However if you look at my <title> tag the Page title is

Photo Archive | Cast Promotional Photos

I'm trying to set the Title Tag to be the same as this

SpoilerTV | Photo Archive | 30 Rock | Season 1 | Cast Promotional Photos

However when I try it appears to be inserting html/link.

It seems that <?php printParentBreadcrumb(); ?> provides all the link/html.

Is there a similar function that will just get the text of the breadcrumb etc

Any help/advice/links most appreciated.

Comments

  • acrylian Administrator, Developer
    No, sorry, there is no direct simple function for that. The easiest would be to make a custom function out of that one without the html tags.

    Perhaps we should have indeed a "get" variant for this. Best you open a ticket for that so we don't forget.
  • Thanks Acrylian.

    Where would I find the printParentBreadcrumb function. Which file would it be in?
  • It's ok found it :)
  • gjr Member
    I use the following function in a few of my themes to get the album/image parent breadcrumb. I would call this in the title tag on album.php and image.php, along with the rest of the title info.
    `
    // Sets expanded titles (breadcrumbs) for Title meta
    function getTitleBreadcrumb($before = ' ( ', $between=' | ', $after = ' ) ') {
    global $_zp_gallery, $_zp_current_search, $_zp_current_album, $_zp_last_album;
    $titlebreadcrumb = '';
    if (in_context(ZP_SEARCH_LINKED)) {
    $dynamic_album = $_zp_current_search->dynalbumname;
    if (empty($dynamic_album)) {
    $titlebreadcrumb .= $before.gettext("Search Result").$after;
    if (is_null($_zp_current_album)) {
    return;
    } else {
    $parents = getParentAlbums();
    }
    } else {
    $album = new Album($_zp_gallery, $dynamic_album);
    $parents = getParentAlbums($album);
    if (in_context(ZP_ALBUM_LINKED)) {
    array_push($parents, $album);
    }
    }
    } else {
    $parents = getParentAlbums();
    }
    $n = count($parents);
    if ($n > 0) {
    $titlebreadcrumb .= $before;
    $i = 0;
    foreach($parents as $parent) {
    if ($i > 0) $titlebreadcrumb .= $between;
    $titlebreadcrumb .= $parent->getTitle();
    $i++;
    }
    $titlebreadcrumb .= $after;
    }
    return $titlebreadcrumb;
    }
    `
  • Awesome, I'll give that a go
  • gjr You are a SUPERSTAR!

    Thank you SO much!
  • acrylian Administrator, Developer
    Yep, that is what I was suggesting. I guess we should have that on board... Not sure why we don't have the usual get/print pair of functions here at all.
  • Several months ago, we started with the zpmasonry theme and customized / expanded it for our needs. One zpmasonry function that we kept (in our theme's functions.php) is getTitleBreadcrumb. It is exactly the same (character for character) as above (gjr's posting from a year ago).

    Our site was working fine until we just now upgraded to 1.4.4. Now it causes an error when we try to view an image in a dynamic album: "Fatal error: Cannot access protected property SearchEngine::$dynalbumname in ...".

    Did 1.4.4 modify property dynalbumname?

    Any suggestions on how to re-write function getTitleBreadcrumb?
  • gjr Member
    Try replacing:

    $_zp_current_search->dynalbumname;

    with:

    $_zp_current_search->getDynamicAlbum();
  • Thanks gjr - that almost did it. That gets the album, but not its name. This actually fixed it:

    $_zp_current_search->getDynamicAlbum()->AlbumName
Sign In or Register to comment.