tctc
Forum Replies Created
-
Forum: Plugins
In reply to: [Ajax Pagination and Infinite Scroll] pagination error on firefoxTested also on Firex and Safari for iOS and got the same error.
Clear example on what happens here:
https://www.versantesud.it/prod/luoghi-verticali/roccia/Please help…
Forum: Plugins
In reply to: [Ajax Pagination and Infinite Scroll] pagination error on firefoxTested also on Firex and Safaori for iOS and same error
Clear example on what happens here:
https://www.versantesud.it/prod/luoghi-verticali/roccia/Please help…
Forum: Fixing WordPress
In reply to: MYSQL QUERY FROM ANOTHER DB CLOSES WP DB CONNECTIONNon one knows how to reopen wordpress database connection?
Forum: Fixing WordPress
In reply to: paging more categoriesOk… anyway I can try different things… for example I can set a template-magazine.php page which shows all posts and where pagination is working. Then, for the other sub-categories I can use template-mag.php
Thank you very much anyway!
Forum: Fixing WordPress
In reply to: paging more categoriesJust tried the new query but I get the error:
Fatal error: Call to a member function get() on a non-object in /web/htdocs/www.snowboarditaliamag.it/home/wp-includes/query.php on line 27
which refers to query.php:
function get_query_var($var) { global $wp_query; return $wp_query->get($var); }
maybe something is missing in the query?
Regarding the pagination problem of the other post, we sorted it out just changing in wp-admin > settings > reading > blog pages show max 10 posts !!thank you for helping….
Forum: Fixing WordPress
In reply to: paging more categoriesPlease also note that if I delete $additional_loop->max_num_pages from the pagination function call, it does not work anymore for last set…
Forum: Fixing WordPress
In reply to: paging more categorieshi vtxyzzy, I try to summarize the problem trying to be as precise as I can….
I have category MAG which is mother of 11 sub-categories. I use permalink and I have a function which delete /category/ from the permalink.
I have also pages under the MAG section. Thus, for the permalink /MAG/ I have both categories and pages…For styling /MAG/ sub-categories I have a file called template-mag.php which gives style to every section depending on the sub-category name.
This page displays the list of posts belonging to the sub-categories and that we made working with pagination last time.Here is the code which displays posts for the sub-categories:
<?php if (is_category('magazine')) { ?> <h1>...do things...</h1><p>...do things...</p> <?php $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query('cat=61&paged=' . $paged); ?> <?php } elseif (is_category('board-sport')) { ?> <h1>ALTRI BOARD SPORT</h1><p>testo libero statico</p> <?php global $query_string; query_posts($query_string); ?> <?php } else { ?><?php } ?> <?php if (have_posts()) : while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
As you can see, I’d like category MAGAZINE (which is child of category MAG, thus permalink is /mag/magazine/) to displays all the posts belonging to mother category /MAG/ (id=61).
Please note that I have no posts under category MAG or MAGAZINE. They are all belonging to other sub-categories.Whit the query I posted, if I go to MAG/MAGAZINE/ I can see 10 posts extracted from /MAG/ mother category but pagination is not working… It gives me back this:
<?php else: ?> <h2><?php _e('Nessun articolo presente'); ?></h2> <p class="center"><?php _e('Nessun articolo presente'); ?></p> <p><?php get_search_form(); ?></p> <?php endif; ?>
I need to write a query which should do that:
1) Sub-category MAGAZINE displays all the posts belonging to mother category MAG (even if no posts belongs directly to cat MAGAZINE or MAG) – i solved this problem using the query
$wp_query = new WP_Query('cat=61&paged=' . $paged);
Then, pagination also should work but actually is not…The rest of the code of the page is taken from https://www.wplover.com/756/how-to-get-custom-wp_query-loop-working-with-pagination-and-wp-pagenavi
Any suggestion is really much appreciated! Thanks a lot!
Forum: Fixing WordPress
In reply to: paging more categorieshi vtxyzzy and thanks for your support!
I have a big problem with pagination that I’m not sure it can be resolved…
Pagination on my website is working properly (we made it working together some days ago!) but now I have a problem with mother category and its child.
I explain: I’ve got category Magazine which is NOT mother of B,C,D,E but I tell it to displays all posts of mother category (ID=61)
Pagination for child categories is working fine but if I display all posts of mother category using the conditional tag is_category , then pagination is not working…
I have one template file where I create the query using the is_category tag:<?php if (is_category('magazine')) { ?> <h1>...do things...</h1><p>...do things...</p> <?php query_posts('cat=61'); ?>; ?> <?php } elseif (is_category('board-sport')) { ?> <h1>...do things...</h1><p>...do things...</p> <?php global $query_string; query_posts($query_string); ?> <?php } else { ?><?php } ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
For pagination I use the following function:
function pagination($pages = '10', $range = 3) { $showitems = ($range * 2)+1; global $paged; if(empty($paged)) $paged = 1; if($pages == '') { global $wp_query; $pages = $wp_query->max_num_pages; if(!$pages) { $pages = 1; } } if(1 != $pages) { echo "<div class=\"pagination\"><span class=\"pagbg\">Pagina ".$paged." di ".$pages."</span>"; if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>?</a>"; if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>? Successivi</a>"; for ($i=1; $i <= $pages; $i++) { if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems )) { echo ($paged == $i)? "<span class=\"current\">".$i."</span>":"<a href='".get_pagenum_link($i)."' class=\"inactive\">".$i."</a>"; } } if ($paged < $pages && $showitems < $pages) echo "<a href=\"".get_pagenum_link($paged + 1)."\">Precedenti ?</a>"; if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>?</a>"; echo "</div>\n"; } }
which I recall using:
<?php if (function_exists("pagination")) { pagination($additional_loop->max_num_pages); } ?>
Any idea on how to create the correct query for pagination to work for mother category and using is_category ?
Thanks a lot as usual!
Forum: Fixing WordPress
In reply to: PAGINATION PROBLEMwell… I noticed that if I change the first query in a way that it recall only one category (mother), the children categories are shown but pagination IS NOT working… always the same error ‘nothing found’….
<?php if (is_category('magazine')) { ?> <h1>SNOWBOARD ITALIA MAGAZINE</h1><p>tutti gli articoli mag</p> <?php query_posts('cat=61'); ?> <?php } elseif (is_category('board-sport')) { ?> <h1>ALTRI BOARD SPORT</h1><p>testo libero statico</p> <?php global $query_string; query_posts($query_string); ?> ........ <?php } else { ?><?php } ?>
I really think it is a problem of query and variables as for the other queries for the other children categories of Mag, pagination works fine…. please help I’m getting crazy with that and already tried thousands of query!!
Forum: Fixing WordPress
In reply to: PAGINATION PROBLEMhttps://www.snowboarditaliamag.it/mag/magazine (user: sim pass: simcity)
This is the page which is taking me crazy…Please note that this page displays posts coming from 11 different subcategories of category parent category ‘mag’. They are extracted using this query:
<?php if (is_category('magazine')) { ?> <h1>SNOWBOARD ITALIA MAGAZINE</h1><p>tutti gli articoli mag</p> <?php query_posts('cat=28,38,39,43,44,45,60,69,77,78,85'); ?> <!-- tira fuori le 8 categorie del menu MAG + update, prodotti-aziende, people-team --> <?php } elseif (is_category('board-sport')) { ?> <h1>ALTRI BOARD SPORT</h1><p>testo libero statico</p> <?php global $query_string; query_posts($query_string); ?> <?php } elseif (is_category('english')) { ?> <h1>NEWS IN ENGLISH</h1><p>testo libero statico</p> <?php global $query_string; query_posts($query_string); ?> <?php } elseif (is_category('eventi-contest')) { ?> <h1>EVENTI E CONTEST</h1><p>testo libero statico</p> <?php global $query_string; query_posts($query_string); ?> <?php } elseif (is_category('interviste')) { ?> <?php } else { ?><?php } ?>
and pagination works with this:
<div class="pagination"> <?php if (function_exists("pagination")) { pagination($additional_loop->max_num_pages); } ?> </div>
where function pagination is:
function pagination($pages = '10', $range = 3) { $showitems = ($range * 2)+1; global $paged; if(empty($paged)) $paged = 1; if($pages == '') { global $wp_query; $pages = $wp_query->max_num_pages; if(!$pages) { $pages = 1; } } if(1 != $pages) { echo "<div class=\"pagination\"><span class=\"pagbg\">Pagina ".$paged." di ".$pages."</span>"; if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>«</a>"; if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>‹ Successivi</a>"; for ($i=1; $i <= $pages; $i++) { if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems )) { echo ($paged == $i)? "<span class=\"current\">".$i."</span>":"<a href='".get_pagenum_link($i)."' class=\"inactive\">".$i."</a>"; } } if ($paged < $pages && $showitems < $pages) echo "<a href=\"".get_pagenum_link($paged + 1)."\">Precedenti ›</a>"; if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>»</a>"; echo "</div>\n"; } }
which is working fine on the other pages….
Thanks!
Forum: Fixing WordPress
In reply to: Sub-category which shows posts list of parent categoryAny idea? do I have to explain better my aim?
Forum: Fixing WordPress
In reply to: pagination problem with last setOk! Solved!! I had to change the configuration in Admin > Settings > Reading and set post to display to 10 like the number of posts_per_page !!
I have to really thanks vtxyzzy for the precious help! THANKS A LOT!
Forum: Fixing WordPress
In reply to: pagination problem with last setIncredible IT WORKS!!!!! but only if posts_per_page is set to 20 . I f I set it to 10 then there are the common problems explained before…. but it already a big step!
Now the question is… how is it possible to set it to 10 posts without having the problems? Where is this problem?!?thank you a lot anyway… really good help! we miss a small step now!
Forum: Fixing WordPress
In reply to: pagination problem with last setwell… got to go sleep it’s 1 o’clock here in Italy! Sorry for big pasting, didn’t know about pastebin….
I really really appreciate your help… I really have no idea on how to solve this problem, even if I’ve already solved all the problem with this site except this one…… ??
I’ll be back tomorrow morning…thank you very much again!Forum: Fixing WordPress
In reply to: pagination problem with last setall the content gave back from
<?php print_r($wp_query); ?>
is:[Code moderated as per the Forum Rules. Please use the pastebin]