/**
 * Outputs classes based on certain user-specified parameters.
 *
 * @since 1.0.0
 */
function themify_theme_query_classes()
{
    global $themify;
    $class = array();
    $class[] = $themify->layout;
    $class[] = $themify->post_layout;
    if (isset($themify->query_post_type) && !in_array($themify->query_post_type, array('post', 'page'))) {
        $class[] = $themify->query_post_type;
    }
    if (themify_is_query_page()) {
        if ($temp_class = themify_theme_get('post_content_layout')) {
            $class[] = $temp_class;
        }
        if ('yes' == themify_theme_get('disable_masonry') && 'slider' !== $themify->post_layout) {
            $class[] = 'masonry';
        }
        if ('no-gutter' == themify_theme_get('post_gutter')) {
            $class[] = 'no-gutter';
        }
        if ($temp_class = themify_theme_get('more_posts', 'infinite')) {
            if ('slider' !== $themify->post_layout) {
                $class[] = $temp_class;
            }
        }
    }
    return implode(' ', apply_filters('themify_theme_loops_wrapper_class', $class));
}
<?php

/**
 * Partial template for pagination.
 * Creates numbered pagination or displays button for infinite scroll based on user selection
 *
 * @since 1.0.0
 */
global $themify;
if ('infinite' == themify_theme_get('more_posts', 'infinite') && 'slider' !== $themify->post_layout) {
    global $wp_query;
    $total_pages = $wp_query->max_num_pages;
    $current_page = get_query_var('paged') ? get_query_var('paged') : 1;
    if ($total_pages > $current_page) {
        if ($themify->query_category != '') {
            //If it's a Query Category page, set the number of total pages
            echo '<script type="text/javascript">var qp_max_pages = ' . $total_pages . '</script>';
        }
        echo '<p id="load-more"><a href="' . next_posts($total_pages, false) . '" class="load-more-button">' . __('Load More', 'themify') . '</a></p>';
    }
} else {
    if ('numbered' == themify_get('setting-entries_nav') || '' == themify_get('setting-entries_nav')) {
        themify_pagenav();
    } else {
        ?>
		<div class="post-nav">
			<span class="prev"><?php 
        next_posts_link(__('&laquo; Older Entries', 'themify'));
        ?>
</span>
			<span class="next"><?php