Viewing 1 replies (of 1 total)
  • Thread Starter mixer

    (@mixer)

    function amur_gallery_func( $atts ) {
        if( function_exists('eazyest_gallery') ){
            $global_post = $GLOBALS['post'];
            global $post;
            global $wp_query;
            $atts = shortcode_atts( array( 'id' => 0 ), $atts );
            $args = array(
                'post_type'      => eazyest_gallery()->post_type,
                'p'              => $atts['id'],
                'posts_per_page' => 1
            );
            $query = new WP_Query( $args );
            if ( $query->have_posts()) {
                $query->the_post();
                if (get_the_ID() == $atts['id'])
                    $out = "<a href=\"".get_the_permalink()."\" title=\"".esc_attr( sprintf( __( 'View folder “%s”', 'eazyest-gallery' ), the_title_attribute( 'echo=0' ) ) )."\" rel=\"bookmark\">".eazyest_frontend()->folder_thumbnail_html( $post_id )."</a>";
            }
            wp_reset_query();
            wp_reset_postdata();
            $GLOBALS['post'] = $global_post;
            return $out;
        }
        return "";
    }
    add_shortcode( 'amur_gallery', 'amur_gallery_func' );
Viewing 1 replies (of 1 total)
  • The topic ‘How to make a shortcode that will display a link to a specific folder?’ is closed to new replies.