0

i have a php file (single-model.php) who display in one div first the post content and than the gallery in thumbs.

How can split the content from gallery and display the gallery in diferent div ..?

the code is this:

<div class="col-xs-12"> 

<?php the_content();

    $ids = get_post_meta( get_the_ID(), 'scent_model_photos', true );

    $selected_images = '';

    if( !empty($ids) ) {

        foreach ($ids as $key => $value) {

            $selected_images .= $key . ',';

        }

    }

    echo do_shortcode('[gallery columns="3" size="model-gallery" link="file" ids="' . $selected_images . '"]'); ?>

</div>
1

You can do something like this

<?php

get_header(); ?>

<section id="content">

    <div class="container">

        <?php get_template_part('inc/page-title'); ?>

        <div class="row">

            <?php if (have_posts()) : ?>

                <?php /* Start the Loop */ ?>

                <?php while (have_posts()) : the_post(); ?>

                    <div class="col-sm-7 post-thumb large-thumbnail">

                        <?php the_post_thumbnail('model-full', array( 'class' => "img-responsive" )); ?>

                    </div>

                    <div class="col-sm-5 entry-content profile">

                        <?php $properties = get_post_meta($post->ID, 'scent_model_data_repeat_group', true);

                                    if (!empty($properties)) {   ?>

                            <ul class="profile">

                            <?php foreach ($properties as $value) {    ?>

                                <li class="row">

                                    <div class="col-xs-4 col-lg-3"><strong><?php echo $value['title']; ?></strong></div>

                                    <div class="col-xs-8 col-lg-9"><?php echo $value['value']; ?></div>

                                </li>

                            <?php } ?>

                            </ul>

                        <?php } ?>

                        <div class="col-xs-12">

                            <?php the_content();

                    $ids = get_post_meta(get_the_ID(), 'scent_model_photos', true);
                    $selected_images = '';

                    if (!empty($ids)) {
                        foreach ($ids as $key => $value) {
                            $selected_images .= $key . ',';
                        }
                    }

                            ?>

                        </div>

                    <div class="col-xs-12">

                      <?php echo do_shortcode('[gallery columns="3" size="model-gallery" link="file" ids="<?php echo $selected_images; ?>"]'); ?>

                    </div>

                    </div>

                <?php endwhile; ?>

                <?php scent_paging_nav(); ?>

            <?php else : ?>

                <?php get_template_part('content', 'none'); ?>

            <?php endif; ?>

        </div>

    </div>

</section>
  • Nope. :( not work.. – Demetris Lyngas Aug 2 '17 at 10:52
  • What didn't work ? what is the error ? is there any log about it ? please try to explain why is not working – Nuno Sarmento Aug 2 '17 at 12:41
  • Ok, here is the error that print me in page – Demetris Lyngas Aug 2 '17 at 13:34
  • Fatal error: Call to undefined function phpget_header() in /home/****/public_html/******/wp-content/themes/scent/single-model.php on line 1 – Demetris Lyngas Aug 2 '17 at 13:34
  • Where do you see "phpget_header() " on my code ? my code is working and is tested – Nuno Sarmento Aug 2 '17 at 14:52

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.