Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • I’m having the same problem as well, maybe there could be a workaround to get the number of wanted posts + 10 (to be safe), then filter out the replies and tweets? (I haven’t really read up or used the REST API, so its just a theory)

    I’m not really comfortable with showing my replies on my site. Ugh, I hate twitter!

    Thread Starter nyubbie

    (@nyubbie)

    Closed. I’m using your loop because it’s what I actually need. Great job on your plugin!

    Your new loop works perfectly! With that fixed, my first loop is working normally now.

    All I need right now is for the first loop to display the pagination separately from the second loop.

    Here’s the code with both loops, as you requested (if you want a reference).

    <div id="body" class="full-block">
        	<div id="main-content">
    			<?php $featured_query = new WP_Query(array( 'category_name' => 'featured', 'posts_per_page' => 3, 'paged' => ( get_query_var( 'paged' ) ))); while( $featured_query->have_posts() ): $featured_query->the_post(); ?>
                	<img class="featured-image" src="" />
                    <span class="featured-title"><?php the_title(); ?></span>
    			<?php endwhile; ?>
                <?php wp_reset_postdata(); ?>
            </div>
            <br /><br /><br />
            <div id="sub-content">
                <?php
    		global $my_exclude_categories;
    		$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
    		$args =  array(
    		'category__not_in' => $my_exclude_categories,
    		'nopaging' => true
    		);
    		add_filter( 'posts_where', 'new_posts_where' );
    		$query = new WP_Query( $args );
    		remove_filter( 'posts_where', 'new_posts_where' );
    	    ?>
                <?php while( $featured_query->have_posts() ): $featured_query->the_post(); ?>
                	<h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permalink to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                    <p><?php the_content(); ?></p>
                <?php endwhile; ?>
                <?php wp_reset_postdata(); ?>
                <?php previous_week_link() . next_week_link(); ?>
            </div>
        </div>

    I can’t thank you enough for helping me with this.

    Right, right now I understand that because of this function,

    add_action( 'pre_get_posts', 'weekly_pagination' );
    function weekly_pagination( $query ) {
    	if ( !is_admin() && $query->is_main_query() ) {
    		if ( is_home() ) {
    			$query->set( 'nopaging', true );
    			add_filter( 'posts_where', 'new_posts_where' );
    		}
    	}
    }

    this actually modifies the entire loop for the index.php page. However, is there a way to limit if( is_home() ) to just a selected loop? Because right now I have 2 queries on my homepage, and this is changing the secondary loop (I’m using the original Loop for the weekly posts) into a weekly one as well.

    Awesome information!

    I’m trying out the WP_Query you’re providing, but it doesn’t seem it work. Right now I’m tweaking the code to see if I can achieve anything with it, but while I’m actually trying to contain the weekly pagination to a single WP_Query itself, I have another WP_Query that displays ‘featured’ content on the same page.

    Pagination is giving me a problem as well, every time I go to /page/2, both content queries go to the next page. I just want one to change. Is it even possible?

    EDIT: I actually found a question on SE that answered whether its possible, I’m giving it a try now to see if it works.

    Link’s here : https://wordpress.stackexchange.com/questions/47259/multiple-wp-query-loops-with-pagination

    This post was exactly what I needed… thanks keesiemeijer!

    Also (to sidetrack a bit), I understand that this custom functions are to be used with the standard WordPress Loop. I tried WP_Query, but it isn’t displaying anything.

    Is there a difference between the standard Loop and a WP_Query Loop?

    Thread Starter nyubbie

    (@nyubbie)

    …and for proposing a change — do I need to provide the code as well? or is it optional?

    Thread Starter nyubbie

    (@nyubbie)

    yeah. I put the changes into a template as directed in the docs…

    thanks for your help! its not that often that a developer comes online to help in the support section.

    Thread Starter nyubbie

    (@nyubbie)

    I went into archive-product.php, and removed <h1 class="page-title"><?php woocommerce_page_title(); ?></h1>.

    I was hoping I could use the remove_action function, but I guess the title wasn’t exactly designed to be hooked and unhooked.

    Why is it like that, though? There are a lot of functions that use hooks, while some of them need to be removed manually from their respective templates… isn’t that a bit confusing?

Viewing 9 replies - 1 through 9 (of 9 total)