Support

Account

Home Forums General Issues Filtering issues which remove images and filters on page

Solved

Filtering issues which remove images and filters on page

  • Hi @shoxt3r

    My guess would be the main films template page you still have:

    <div id="ajax_filter_films">	      
    <?php      
    $args = array(
    	'post_type'			=> 'film',
    	'posts_per_page'	=> -1,
    );
            
    $query = new WP_Query( $args );
    if( $query->have_posts() ) :
    	while( $query->have_posts() ): $query->the_post();
        ?>
    	<h2><?php the_title(); ?></h2>
    	<?php
    	endwhile;
    	wp_reset_postdata();
    else :
    	echo 'No films found matching your criteria.';
    endif;
    ?>  
    </div><!-- /ajax_filter_films -->

    Which if I view the source code on your link, just shows a list of H2 tags

    So you need to replace the bit in the while loop with whatever you need to show.

  • Ah of course, thanks for your help!

  • Hi Jarvis,

    Hope you’re well?
    Unfortunately since implementing this, I’ve found adding a redirect to the Homepage for users when they login breaks the films filters and actually inputs part of the page they’re redirected to in place of the filtered data.

    I don’t know enough about Ajax at this stage to work out what the problem is exactly but it’s like the page is working like an iframe and trying to place the Homepage content into the “filtered-films” element.

    // Redirect subscriber accounts to homepage
    add_action('admin_init', 'redirectSubscribersToHomepage');
    
    function redirectSubscribersToHomepage()
    {
    	$currentUser = wp_get_current_user();
    
    	if (count($currentUser->roles) == 1 AND $currentUser->roles[0] == 'subscriber') {
    		wp_redirect(site_url('/'));
    		exit;
    	}
    }

    https://pasteboard.co/GoO2kKmKWfoo.png

    Any thoughts please?

Viewing 3 posts - 26 through 28 (of 28 total)

You must be logged in to reply to this topic.