$_GET value is losing it’s space

It turns out it was the WPML redirection that is removing the spaces from my input. To fix it, I’ve added the language code in the form action. <form action=”/<?php echo ICL_LANGUAGE_CODE; ?>/” method=”get” id=”searchform”>

Search result page as a new page

You can use custom template for search page: <?php get_header(); ?> <section id=”primary” class=”content-area”> <div id=”content” class=”site-content” role=”main”> <?php if ( have_posts() ) : ?> <header class=”page-header”> <h1 class=”page-title”><?php printf( __( ‘Search Results for: %s’, ‘shape’ ), ‘<span>’ . get_search_query() . ‘</span>’ ); ?></h1> </header><!– .page-header –> <?php shape_content_nav( ‘nav-above’ ); ?> <?php /* Start … Read more

Custom post url in search.php isn’t the correct rewrited url

Solved, it was an issue with assigned parent- and subcategories. Because I’m using the ‘WP All Import’ plugin connected to Google Drive, posts are automatically imported. Since some of the posts don’t have categories assign in the Google Drive document, ‘WP All import’ doesn’t assign a category on importing the data. For some reason this … Read more

Adding custom search button to menu

This code is from the full-screen-search.js file of the plugin in which replace the selector of search input and button with your font awesome button selector as shown below: jQuery( document ).ready( function( $ ) { // … display the Full Screen search when user clicks the font awesome button $( ‘<font awesome button selector>’ … Read more

Replacing wordpress search with custom code

Sorry about my english. I think you must use the build-in query hook to send your posts ids to the main query. It use the pre_get_posts hook. That will allow you to change the query after it’s creation, and before it’s execution. add_action(‘pre_get_posts’, ‘my_search_query’); function my_search_query($query) { if($query->is_search() && $query->is_main_query() && get_query_var(‘s’, false)) { // … Read more

Partial searches for wp_usermeta

<?php // ALWAYS sanitize user input! $poblacion = sanitize_text_field( $_GET[‘poblacion’] ); $trabajo = sanitize_text_field( $_GET[‘trabajo’] ); $usuarios = get_users( array( ‘role’ => ’empresa-BBDD’, ‘order_by’ => ‘nicename’, ‘order’ => ‘ASC’, ‘meta_query’ => array( // search for user meta data ‘relation’ => ‘AND’, array( ‘key’ => ‘poblacion’, ‘value’ => $poblacion, ‘compare’ => ‘LIKE’ // partial comparison ), … Read more

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