Forum Replies Created

Viewing 15 replies - 16 through 30 (of 50 total)
  • Thread Starter Raider000

    (@raider000)

    Well, it’s the main category used by WooCommerce, so I think it must be a custom post type but not really sure. It wasn’t created by myself.

    Thread Starter Raider000

    (@raider000)

    Well thanks but I don’t think that this is the right solution to my issue. I even deactivated WooCommerce and it was still all the same. Even when I want to view the created page from the backend, it comes up with 404. It’s just weird that they get loaded on the front page but not when you want to browse them single using the permalink.

    Thread Starter Raider000

    (@raider000)

    Sure, it’s http://goo.gl/5lQR44 but I have now reset the permalink structure back to post name.

    Thread Starter Raider000

    (@raider000)

    That’s because none of the URLs (css, JS etc.) gets loaded.

    Thread Starter Raider000

    (@raider000)

    I use my own theme and use post name as permalink (http://mysite.com/sample-post). The theme wasn’t meant to work with this permalink structure only but I would like to keep the same settings though.

    Thread Starter Raider000

    (@raider000)

    Well, when I set the permalink settings to default, the URLs seem to work but it absolutely destroys the layout of my whole website. And when I change the setting back to the way it was, they won’t work and still lead me to the 404 page.

    Thread Starter Raider000

    (@raider000)

    Oh wow, this works great! Thank you so much!!!

    Thread Starter Raider000

    (@raider000)

    Hi again,

    I made it now! This works:

    function showAllNews() {
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    	$args = array(
    			'posts_per_page' => get_option('posts_per_page'),
    			'post_type' => 'news',
    			'orderby' => 'date',
    			'order' => 'DESC',
    			'paged' => $paged
    	);
    	$loop = new WP_Query( $args );
    	while ( $loop->have_posts() ) : $loop->the_post();
    	?>
    	<div class="span5 news-container left-align listnews">
    		<h3><?php the_title(); ?></h3>
    		<p>
    			<?php echo substr(get_the_content(), 0, 180); ?>
    			<?php if (strlen(get_the_content()) > 180) { echo " ..."; } ?>
    		</p>
    		<a class="news-button" href="<?php the_permalink(); ?>">Weiterlesen</a>
    	</div>
    
    	<?php
    	endwhile;
    	previous_posts_link ( '<span class="meta-nav">&larr;</span>Zurück', $loop->max_num_pages );
    	echo '&nbsp;&nbsp;&nbsp;';
    	next_posts_link( 'Weiter<span class="meta-nav">&rarr;</span>', $loop->max_num_pages );
    }

    With next and previous_posts_link I have only 2 links. Is there a way I could have numbers for my pagination?

    Thread Starter Raider000

    (@raider000)

    That’s perfect, I’ll see what I can find out. Thank you!!

    Thread Starter Raider000

    (@raider000)

    I have also tried this code:

    function showAllNews() {
    /**
     * Displays the Pagination in Custom loop
     *
     */
    
    get_header();
    $temp = $wp_query; //save old query
    $wp_query= null; //clear $wp_query
    
    //The query
    $wp_query = new WP_Query();
    $wp_query->query( array( 'post_type' =>'news', 'posts_per_page'=>3, 'paged' => $paged ) );
    //The loop
    while ($wp_query->have_posts()): $wp_query->the_post(); 
    
         the_title();
    
    endwhile;
    
    //Pagination part
    if(function_exists('wp_pagenavi') ) {
         wp_pagenavi(); //function call for plugin pagination( wp pagenavi plugin)
    }else{ ?>
         <ul class="pagination">
              <li class="previous"><?php next_posts_link('Previous'); ?></li>
    	  <li class="next"><?php previous_posts_link('Next'); ?></li>
         </ul>
    <?php
    }//endif
    wp_reset_postdata();
    $wp_query = null; //Reset the normal query
    $wp_query = $temp;//Restore the query
    
    get_footer();
    }

    I get the title of my custom pages but here it won’t show me the pagination as well.

    This code I just copy/pasted from http://devotepress.com/coding/wordpress-custom-loop-pagination/

    I didn’t change much and I don’t really see why it won’t work. I think I visited all google sites to find a solution for this!

    Thread Starter Raider000

    (@raider000)

    I have tried it like this:
    query_posts($category."&paged=".$paged."&showposts=".$number_posts);
    Is this correct?
    It’s still not doing anything.

    Thread Starter Raider000

    (@raider000)

    Hi

    Thanks for this. I tried to build it like that but it won’t work for me somehow.

    Here is my full code, maybe you see what’s wrong.

    function usePermalinks($weiter, $zurueck) {
    	global $paged;
    	$number_posts = get_option('posts_per_page');
    	$paged = get_query_var('paged');
    	$category = "showposts=".$posts;
    	query_posts($category."&paged=$paged&showposts=$number_posts");
    	$paged = get_query_var('paged') ? get_query_var('paged') : 1;
    
    	if ($paged > 0) {
    	echo var_dump(next_posts_link()) ;
    		if (get_next_posts_link()) {
    			echo '<br /><div class="pagination">' . next_posts_link($weiter) . '</div>';
    		}
    
    		if (get_previous_posts_link()) {
    			echo '<br /><div class="pagination">' . previous_posts_link($zurueck) . '</div>';
    		}
    	}
    	else  {
    		echo '<br /><a class="blog_link" href="#" onclick="history.go(-1);return false;";>Back to the list</a>';
    	}
    }
    
    function showAllNews() {
    	$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    	$args = array(
    			'posts_per_page' => 6,
    			'post_type' => 'news',
    			'orderby' => 'date',
    			'order' => 'DESC',
    			'paged' => $paged
    	);
    	$loop = new WP_Query( $args );
    	while ( $loop->have_posts() ) : $loop->the_post();
    	?>
    	<div class="span3 news-container left-align">
    		<h3><?php the_title(); ?></h3>
    		<p>
    			<?php echo substr(get_the_content(), 0, 180); ?>
    			<?php if (strlen(get_the_content()) > 180) { echo " ..."; } ?>
    		</p>
    		<a class="news-button" href="<?php the_permalink(); ?>">Weiterlesen</a>
    	</div>
    
    	<?php
    	endwhile;
    	usePermalinks("Vor", "Zurück"); // This won't work
    
    	next_posts_link('Older Entries'); // This won't work
        previous_posts_link('Newer Entries'); // This won't work
    
    	wp_query_reset();
    }
    add_shortcode('showAllNews', 'showAllNews');

    The shortcode I use on a page of my Custom Post Type.

    Thread Starter Raider000

    (@raider000)

    I figured out that get_next_posts_link () is always NULL. But why?

    Thread Starter Raider000

    (@raider000)

    Sorry I forgot to mention. I was testing this local. I was also testing the same on de development tool of Google Chrome on ‘element-style’. It doesn’t change anything though.

    Thread Starter Raider000

    (@raider000)

    Thanks for your research, alchymyth!

    But as well as the style is using a left margin, it is also using a right margin with same pixels.

    As I don’t want to change the bootstrap files, I have added the following code to my own CSS file but for some reason it seems not to work:

    .nav-collapse .dropdown-menu { margin: 0 !important; }

Viewing 15 replies - 16 through 30 (of 50 total)