George Posted November 15, 2013 Posted November 15, 2013 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)
dragan Posted November 15, 2013 Posted November 15, 2013 I know nothing about Twig, but that piece of code you posted looks like Wordpress code. Are you sure you're in the right CMS forum?
George Posted November 15, 2013 Author Posted November 15, 2013 Hi Dragan, you are right, that code belongs to a wp theme, i miss the whole picture, i was looking for a twig support forum and you appear on the results. What a waste of time, sorry dude. Thanks anyway. ( i will remove my account) 3
Martijn Geerts Posted November 15, 2013 Posted November 15, 2013 You get a like for your response. (Do yourself a favour, invest some time in PHP. Starting is hard, the rest will follow!) 5
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now