cl3rik
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Filter by custom field and paginationHi,
I tried coding the archive page with one loop only and seems work but…ONLY if I set in the query post the meta key and the meta value “manually”. If I set them throught 2 variables passed via POST it doesn’t work. ??
Above the loop I tried this code:
<?php /*if (isset($_POST['year'])) { $meta_key="year"; $meta_value=$_POST['year'];*/ $page = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("cat=12&posts_per_page=1&meta_key=$meta_key&meta_value=$meta_value&paged=$page"); } ?>
Then Loop:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
Then some HTML/PHP code…
Then:
<?php endwhile; ?> <?php endif; ?> <?php wp_reset_query(); ?>
Thanks
ckForum: Fixing WordPress
In reply to: Filter by custom field and paginationNothing, same problem. As you said, maybe that works with one loop only.
Any idea how to manage this goal? maybe with a plugin? any tip is welcome ??
thanks
ckForum: Fixing WordPress
In reply to: Filter by custom field and paginationHere’s the code:
<?php get_header(); ?> <div id="content" class="bg_sidebar"> <div id="inner_content"> <span class="meta"><?php echo $punchline; ?></span> <?php if (isset($_POST['year']) || isset($_POST['genre'])) { ?> <?php if (isset($_POST['year'])) { $valore_variabile=$_POST['year']; $nome_variabile="year"; } if (isset($_POST['genre'])) { $valore_variabile=$_POST['genre']; $nome_variabile="genre"; } ?> <h2><?php echo $valore_variabile; ?> projects</h2> <?php $page = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("cat=12&posts_per_page=1&meta_key=$nome_variabile&meta_value=$valore_variabile&paged=$page"); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="entry-project" onclick="window.open('<?php the_permalink() ?>', '_self');"> <?php $cover = get_post_meta($post->ID, "cover", true); if( $cover != "" ) { $resizepath = get_bloginfo('template_url')."/timthumb.php?src="; #timthumb path $resize_options1 = "&w=50&h=70&zc=1"; $cover = $resizepath.$cover.$resize_options1; } ?> other code, just some get post meta etc etc... <br clear="all" /> </div> <?php endwhile;?> <?php endif; ?> <?php } else { ?> <h2>Recent <?php single_cat_title(); ?> projects</h2> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="entry-project" onclick="window.open('<?php the_permalink() ?>', '_self');"> <?php $cover = get_post_meta($post->ID, "cover", true); if( $cover != "" ) { $resizepath = get_bloginfo('template_url')."/timthumb.php?src="; #timthumb path $resize_options1 = "&w=50&h=70&zc=1"; $cover = $resizepath.$cover.$resize_options1; } ?> other code, just some get post meta etc etc... <br clear="all" /> </div> <?php endwhile; ?> <?php endif; ?> <?php } ?> <div class="pagination"> <?php posts_nav_link(); ?> </div> </div> <?php get_sidebar('projects'); ?> </div><!-- end content--> <?php get_footer(); ?>
Forum: Fixing WordPress
In reply to: Filter by custom field and paginationThanks for response.
I’ve added that argument but it doesn’t work. The previous_posts_link() and next_posts_link() are at the end of the archive.php
In the sidebar I tried both
<form action="<?php bloginfo('url'); ?>/category/projects/" method="post">
and
<form action="<?php bloginfo('url'); ?>/" method="post">
Still nothing.
Thanks
ck