Custom functions?

Hello,

Still new here, learning how Zen gallery works:)

A quick question:

I'd like to over-ride a function which shows the RSS link+icon in the footer of the gallery.

One way (I guess), is to 'hack' `template-functions.php` and make the edit there (say, I want to use 'icon.png' instead, or no icon at all - things happen here:
`$icon = ' RSS Feed';`
- I could edit the filename, for example)

Other would be to place a some kind of functions.php file in the current THEME dir and there create and modify the RSS part. Thus, when I make an upgrade, my customized 'RSS icon' part won't be deleted...

My question would be:

How'd I do it? And is it easy? :-)

Thanks in advance for pointing me out in the correct direction! :-)

Comments

  • acrylian Administrator, Developer
    You don't need to hack the function for that, the icon is an option: http://www.zenphoto.org/documentation/Zenphoto/_template-functions.php.html#functionprintRSSLink
  • OK, I agree:

    Let's say, I change this line to:
    `function printRSSLink($option, $prev, $linktext, $next, $printIcon=false, $class=null) {`

    ...still, I would do this by editing directly the file 'template-functions.php'. Next time I make an upgrade, the file will be over-written by a newer version, right? (or maybe I'm wrong or missing something?)

    I think, in WordPress, each theme can have its own custom functions, or override core WP functions, if a function is specified in the 'functions' file in the theme directory. Maybe Zen Gallery has a similar approach? Or different one?

    I'm not very good in programming, and still trying to understand the way Zen works, please forgive me if I asked a stupid question... :)
  • zenphoto has this too... just put an customfunctions.php file in your theme directory and put a:
    '<?php require_once ('customfunctions.php'); ?>'
    at the top of the page that requires the custom function eg image index or album.php.

    what I do myself if I change a function like getalbumLinkURL() is renaming it in my customfunctions. php to getAlbumLinkURLCustomized() so I now when working on my theme pages that not the original function is used
  • acrylian Administrator, Developer
    optimiced: The forum is for asking questions...:-) Yes, as Bert said, you can have customfunction, but you don't need one in this case.
    To get "rid" of the icon you can just edit the function call in your theme pages from
    `<?php printRSSLink('Gallery','','RSS', ' | '); ?>` (default theme index.php example) to
    `<?php printRSSLink('Gallery','','RSS', ' | ,false); ?>` and gone is the icon.

    Additionally you can write `<?php printRSSLink('Gallery','','RSS', ' | ,false, "rsslink"); ?>` where "rsslink" would be an example name for a CSS class you can directly assign to that link if you want to style it specifically.
  • @BertSimons, @acrylian:

    Thank you very much for these detailed answers! Now off me go testing the proposed solutions ;-)
Sign In or Register to comment.