Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Items Manager+i18n Gallery - how to dynamically change gallery's name?
#1
Hello

I have encountered a problem that overgrow me as I'm not PHP programmer. I have a list of items created with Items Manager. To each item I have to add a gallery (I want to do it with i18n Gallery). I have created a template to display items from Items Manager and I want to add there a gallery to each item (galleries are created usual way). Unfortunatelly (% gallery %) in WYSIWYG field is not working, so the only solution is to add php code in template that displays item's details. Gallery plugin require that:

<?php get_i18n_gallery_header('gallery-name'); ?> in header and <?php get_i18n_gallery('gallery-name'); ?> in the body.

Problem is I can't add static name in the template as gallery for each item is different. So it would be the best so I could change 'gallery-name' to according name that would be taken from a variable taken from Items Manager. I have a text-field in Items Manager with gallery name for each item.

Question is: how can I replace 'gallery-name' in i18n Gallery code inside template with appropriate name taken from Items Manager text-field? I guess it requires some PHP trick, but my knowledge of PHP is just to know where to put something in my HTML code.
Reply
#2
blazejs Wrote:Hello

I have encountered a problem that overgrow me as I'm not PHP programmer. I have a list of items created with Items Manager. To each item I have to add a gallery (I want to do it with i18n Gallery). I have created a template to display items from Items Manager and I want to add there a gallery to each item (galleries are created usual way). Unfortunatelly (% gallery %) in WYSIWYG field is not working, so the only solution is to add php code in template that displays item's details. Gallery plugin require that:

<?php get_i18n_gallery_header('gallery-name'); ?> in header and <?php get_i18n_gallery('gallery-name'); ?> in the body.

Problem is I can't add static name in the template as gallery for each item is different. So it would be the best so I could change 'gallery-name' to according name that would be taken from a variable taken from Items Manager. I have a text-field in Items Manager with gallery name for each item.

Question is: how can I replace 'gallery-name' in i18n Gallery code inside template with appropriate name taken from Items Manager text-field? I guess it requires some PHP trick, but my knowledge of PHP is just to know where to put something in my HTML code.

I guess the easiest way is this:

Code:
<?php get_i18n_gallery_header(return_custom_field('AField')); ?>
in header and
Code:
<?php get_i18n_gallery(return_custom_field('AField')); ?>
in the body.

And make sure you make a new custom field in the special page, where you can name the gallery and then put the name of the field instead of ('AField').
Reply




Users browsing this thread: 1 Guest(s)