(function($) {
$('#showmemore a').live('click', function(e){
e.preventDefault();
$(this).addClass('loading').text('LOADING...');
$.ajax({
type: "GET",
url: $(this).attr('href') + '#loop',
dataType: "html",
success: function(out){
result = $(out).find('#loop .post');
nextlink = $(out).find('#showmemore a').attr('href');
$('#loop').append(result.fadeIn(300));
$('#showmemore a').removeClass('loading').html('Show me more');
$('#showmemore a').attr('href', nextlink);
}
});
});
})(jQuery)
<?php
while ($my_albums->have_posts()) : $my_albums->the_post();
// do more stuff with other loops
endwhile; if($my_albums->get('paged') != $my_albums->max_num_pages) { ?>
<div id="showmemore"><?php next_posts_link('Show Me More') ?></div>
<?php } else { ?>
<style>#showmemore{display:none;}</style>
<?php }?>
add_filter( 'posts_where', 'title_like_posts_where', 10, 2 );
function title_like_posts_where( $where, &$wp_query ) {
global $wpdb;
if ( $post_title_like = $wp_query->get( 'post_title_like' ) ) {
$where .= ' AND ' . $wpdb->posts . '.post_title LIKE \'' . esc_sql( like_escape( $post_title_like ) ) . '%\'';
}
return $where;
};
function yo_pre_get_posts( $query ){
if( $query->get( 'yo_custom_var' ) == 'foobar' )
{
global $wpdb;
$request = 'a';
$offset = 0;
if( isset($_GET['page']) && !empty($_GET['page']) ){
$offset = ($_GET['page']-1) * 100;
}
$my_query = $wpdb->get_results("
SELECT * FROM $wpdb->posts
WHERE post_title LIKE '$request%'
AND post_type = 'artist'
AND post_status = 'publish'
LIMIT 100 OFFSET $offset;
");
return $my_query; }
}
add_action( 'pre_get_posts', 'yo_pre_get_posts', 10 );
$wp_query = new WP_Query( array(
...
'yo_custom_var' => 'foobar',
...
) );
while ($wp_query->have posts()) : $wp_query->the post();
//do stuff
endwhile;
$text = (!$abc) ? "</ul>";
$text = (!$abc) ? '</ul>' : '';
$content = $post->post_content;
if ( !strtolower($content[0]) = $request ) continue;
$query = new WP_Query( $args );
INSERT INTO wc_terms (term_id, name, slug) VALUES
(1, 'example text', 'example-text'),
(2, 'example text text', 'example-text-text'),
(3, 'example text', 'example-text')
ON DUPLICATE KEY UPDATE slug = CONCAT_WS('-', VALUES(slug), VALUES(term_id));