Jump to content

Learning advice and coding help


George
 Share

Recommended Posts

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)

Link to comment
Share on other sites

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)

  • Like 3
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...