alesub
Forum Replies Created
-
Forum: Plugins
In reply to: [Plugin: Contact Form 7] Adding insert into mysql…Hi!
This post was a huge help. I’m attempting to do the same, so if I found out where that’s happening I’ll let you know.
Thanks so much!
Forum: Plugins
In reply to: grant “author” role access to a pluginApparently using “author” or “editor” doesn’t work, to do this I needed to use the user level:
add_menu_page('My Plugin', 'My Plugin', 2, __FILE__, 'lic_settings_page');
Maybe using the roles will work on WP3 ??
Forum: Plugins
In reply to: Adding Menu PagesHi,
Are you including those pages before making the call? Maybe you could try including them inside the function, something like:
function hg_menu_main(){ include('your_file.php'); }
It’s not a clean way, but it worth the shot I think ??
Hey,
I’m back with the solution for the query involving two custom fields, it was just a matter of a simple sql trick:
SELECT wposts.* FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta, $wpdb->postmeta wpostmeta2 WHERE wposts.ID = wpostmeta.post_id AND wposts.ID = wpostmeta2.post_id AND wpostmeta.meta_key = 'order' AND wpostmeta2.meta_key = 'complete' AND wpostmeta2.meta_value = '1' AND wposts.post_type = 'post' AND wposts.post_status = 'publish' ORDER BY wpostmeta.meta_value ASC
I found it here:
https://kovshenin.com/archives/customize-posts-order-in-wordpress-via-custom-fields/??
Enjoy!
Forum: Fixing WordPress
In reply to: Adding Pagination to a WP_Query LoopHi,
Using the great code from layotte, I’ve managed to add page links in the following way:
[ 1 ] [ 2 ] [ 3 ] [ Next ]
here’s the code:
<?php //The Query $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $new_query = new WP_Query(); $new_query->query( 'showposts=10&cat='.$category_id.'&paged='.$paged ); //The Loop while ($new_query->have_posts()) : $new_query->the_post(); // display posts as you need endwhile; // pager if($new_query->max_num_pages>1){?> <p class="pager"> <?php for($i=1;$i<=$new_query->max_num_pages;$i++){?> <a href="<?php echo get_category_link($category_id).'page/'.$i;?>" <?php echo ($paged==$i)? 'class="active"':'';?>><?php echo $i;?></a> <?php } if($paged!=$new_query->max_num_pages){?> <a href="<?php echo get_category_link($category_id).'page/'.$i;?>">Siguiente</a> <?php } ?> </p> <?php } ?>
Hope you find it useful!
Hi!
Yes, I’m with the same trouble as seborgarsen, I need to use two meta keys on a query: One to filtering posts and another to sort them.
This is my query so far:
SELECT DISTINCT wposts.* FROM wp_posts wposts LEFT JOIN wp_postmeta wpostmeta ON wposts.ID = wpostmeta.post_id LEFT JOIN wp_term_relationships ON (wposts.ID = wp_term_relationships.object_id) LEFT JOIN wp_term_taxonomy ON (wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id) WHERE wp_term_taxonomy.taxonomy = 'category' AND wp_term_taxonomy.term_id IN(4,18,19,20,21) AND wpostmeta.meta_key = 'engine' AND wpostmeta.meta_value+0 >= 7.5 AND wpostmeta.meta_key = 'weight' ORDER BY wpostmeta.meta_value+0 desc LIMIT 25
Could I be asking too much?
Thanks in advance!