0

I have inherited a website. In a section there's a few custom post types, and they are placed there with a shortcode. They have a functionality that when you clikc on one, instead of going to the single post type page, which exists and is what I want to achieve (basically the easy functionality). they display a modal. I have found out that this modal is defined in inc/shortcodes.php. I'm not really familiar with this. Is there a way to remake this wp_Query to go back to it's basic, no modal functionality?

function mostrar_obras_en_curso($atts, $content = null) {

    //add_filter( 'post_limits', 'somhi_query_limit_8' );
   $new_loop = new WP_Query ( array(
      'post_type'     => 'obras_en_curso',
      'pagination'    => false,
      'posts_per_page' => -1
   )  );

    if ( $new_loop->have_posts() ) :
        while ( $new_loop->have_posts() ) : $new_loop->the_post(); ?>

        <?php
        $id = get_the_id();
        $modalid = 'modal-'.$id;
        ?>

            <div class="small-6 medium-4 columns">
                <a href="#" data-reveal-id="<?php echo $modalid ?>">
                    <div class="obras-container">
                        <div class="obras-img">
                            <?php 
                            the_post_thumbnail();
                            $img1 = get_field('img-1');
                            $img2 = get_field('img-2'); 
                            ?>
                        </div>

                        <div class="obras-text">
                            <h4><?php the_title() ?></h4>
                            <p><?php the_field('description'); ?></p>
                        </div>
                    </div>
                </a>
            </div><!-- col -->

            <!-- start of modal -->
            <div id="<?php echo $modalid ?>" class="reveal-modal obras-en-curso" data-reveal style="opacity: 1; visibility: hidden; display: none;">

                <a class="close-reveal-modal">&#215;</a>

                <div class="container container-slider">
                    <div class="obras-curso-slider">
                        <ul>
                        <?php
                        for ($i = 0; $i <= 100; $i++) {
                            $img = get_field('img-'.$i);
                            if( !empty($img) ): ?>
                                <li><img src="<?php echo $img['url']; ?>"/></li>
                            <?php endif;
                        }
                        ?>
                        </ul>
                    </div><!-- project-slider -->
                </div><!-- container -->

            </div><!-- modal -->

    <?php endwhile; endif; wp_reset_query();
}
1

You could change this line :

<a href="#" data-reveal-id="<?php echo $modalid ?>">

to :

<a href="<?php echo get_permalink(); ?>">
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.