Hey guys! im quite new about twig and template design, i barely know php and i need some advice if its necesary to know php at all i order to learn to program with twig.
At this moment also im editing a template based on twig that i bought, most the changes on the css but right now im facing a fancybox gallery which just call the first image, and a will like to add the gallery rel to the other images included in the post. i already found the missing code which call the rest of images from the post ID, but i dont know how to express it by the twig structure.
this is the code wich display the gallery:
<code>
{% if wp.get_post_meta(post.ID, '_property_slides', TRUE) %} <div class="carousel property"> <div class="preview"> <a href="{{ wp.get_post_meta(post.ID, '_property_slides', TRUE).0.imgurl }}" class="fancybox"> <img src=" {{ wp.get_post_meta(post.ID, '_property_slides', TRUE).0.imgurl }}" alt=""> </a> </div> <!-- /.preview --> <div class="content"> <ul> {% for slide in wp.get_post_meta(post.ID, '_property_slides', TRUE) %} {% if loop.first %} <li class="active" > {% else %} <li> {% endif %} <img src="{{ slide.imgurl }}" alt=""> </li> {% endfor %} </ul> <a id="carousel-prev" href="#">{{ wp.__('Previous', 'aviators') }}</a> <a id="carousel-next" href="#">{{ wp.__('Next', 'aviators') }}</a> </div> <!-- /.content --> </div><!-- /.carousel --> {% endif %}
</code>
THIS IS THE FUNCTION TO CALL THE IMAGES I NEED
<code>
add_filter(‘wp_get_attachment_link’,'add_gallery_id_rel’); function add_gallery_id_rel($link){ global $post; return str_replace(‘<a href’, ‘<a rel=”galeria’. $post->ID .’” href’, $link); }
</code>
I really appreciate if you can help me with this (sorry about my weird english)