Passing values by form to create a query

It all depends on how you’re trying to do it. When it comes to filtering results, i usually setup the form to use $_GET and filter the results when the page loads again: if (isset($_GET[‘term’])) { $term = $_GET[‘term’]; } else { $term = ‘defaultTerm’; } if (isset($_GET[‘childterm’])) { $childterm = $_GET[‘childterm’]; } else { … Read more

Access Tables with number prefix

When in multisite, the wpdb prefix is always the prefix required to access the tables for the current site. This includes the site ID so this should work: $wpdb->get_results($wpdb->prepare(“SELECT * FROM “.$wpdb->prefix.”options WHERE …..”)); There should be no difference at all when using multisite, just make your queries as if it were single site.

Show custom posts with a specific “custom TAXONOMY slug” on startpage

For taxonomy superevent and term true: add_action(‘pre_get_posts’,’wpse57309_alter_front_page_query’); function wpse57309_alter_front_page_query( $query ){ if( $query->is_main_query() && is_front_page() ){ if( !$query->get(‘post_type’) ){ //post type is not set, the default will be an array of them: $query->set( ‘post_type’, array( ‘news’, ‘events’, ‘tv’ ) ); $query->set( ‘superevent’, ‘true’ ); } } }

Any way to insert text on page from a query results?

Ok, but I was afraid it’s not really a good solution. Works, though. First, I rewrote the query in order to get pretty permalinks: /*Añadido: Reescribir URL query: “?pa_dispositivo=nombre&pa_marca=nombre”*/ function custom_rewrite( $wp_rewrite ) { $feed_rules = array( ‘tipo/(.+)/marca/(.+)’ => ‘index.php?pa_dispositivo=’. $wp_rewrite->preg_index(1).’&pa_marca=”. $wp_rewrite->preg_index(2) //”(.+)’ => ‘index.php?pa_marca=”. $wp_rewrite->preg_index(1) //”(.+)’ => ‘index.php?pa_dispositivo=’. $wp_rewrite->preg_index(1) ); $wp_rewrite->rules = $feed_rules + … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)