0

after a search throughout the already asked questions I couldn't come to a solution to my problem, this one is the closest I found: My custom post type displays the [latest post]

I had a slider built into the homepage, but I have noticed that after a while of it working fine, it now only displays the latest post type.

Here is the current code for the slider:

<div class="half slide-container">
            <ul class="slider">
                <?php
                    $slides = get_posts( array(
                        'numberposts' => 6,
                        'post_type' => 'slides',
                        'orderby' => 'post_date'
                    ) );
                    foreach( $slides as $post ) :
                        setup_postdata( $post );
                        $args = array(
                            'post_type' => 'attachment',
                            'numberposts' => null,
                            'post_status' => null,
                            'orderby' => 'post_date',
                            'order' => 'ASC',
                            'post_parent' => $post->ID
                        ); 
                    $attachments = get_posts( $args );
                ?>
                    <li data-background="http://www.serps.co.uk/cdn/PG/background14.png">
                        <?php the_content(  ); ?>
                    </li>
                <?php endforeach; ?>
            </ul>
        </div>

I'm relatively new to .php, but I thought I had spotted a couple of syntax errors but the slider still remained broken.

I changed it to this to no avail:

<div class="half slide-container">
            <ul class="slider">
                <?php
                    $slides = get_posts( array(
                        'numberposts' => '3',
                        'post_type' => 'slides',
                        'orderby' => 'post_date'
                    ) );
                    foreach( $slides as $post ) :
                        setup_postdata( $post );
                        $args = array(
                            'post_type' => 'attachment',
                            'numberposts' => '3',
                            'post_status' => 'publish',
                            'orderby' => 'post_date',
                            'order' => 'ASC',
                            'post_parent' => $post->ID
                        ); 
                    $attachments = get_posts( $args );
                ?>
                    <li data-background="http://www.serps.co.uk/cdn/PG/background14.png">
                        <?php the_content(  ); ?>
                    </li>
                <?php endforeach; ?>
            </ul>
        </div>

You can view this live on the website here: Polesworth Garage

2
  • Also - could someone point me to support / forum rules please?
    – SamDemeda
    Oct 12 '15 at 16:02
  • Check out help center for all rules, help and basic info, also, take the tour ;-) Oct 12 '15 at 17:09
0

Your slider looks fine. It just doesn't work because the JavaScript on the page is broken elsewhere - namely on your search facility:

Timestamp: 2015-10-12, 10:51:50 AM
Error: TypeError: tree[x] is undefined
Source File: http://www.polesworth-garage.com/
Line: 1200
2
  • Is the slider fine before I made my adjustments - is it just the JS I need to look into? I've never worked with JS, but I will look into this as my first point of attack :-)
    – SamDemeda
    Oct 13 '15 at 8:18
  • If you look at your source code you'll see all of the slides are there, they are just not sliding. A javascript error in one place can break javascript everywhere on the page.
    – vancoder
    Oct 13 '15 at 15:59

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.