top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

How to invisible the message "No result found" during page loading in Wordpress?

0 votes
88 views

I want to disable the message "No result found" during page loading in my Wordpress site.

$search_code = $_POST['search_code'];

global $wpdb;

$helloworld_id = $wpdb->get_var("SELECT s_image FROM search_code WHERE s_code = $search_code");

if (empty($helloworld_id)) { 
echo '<div class="no_results">No results found</div>'; 
}
else 
{ 
?>

<img src="http://igtlaboratories.com/wp-content/uploads/images/<?php echo $helloworld_id; ?>"style="width:200px;height: auto;">

<?php
}
}

I used this code but when page load by default "No result found" visible. How I disable this massage during page load. Any help?

posted Jul 28, 2017 by Kavyashree

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Use this code

if(isset($_POST['search_code']) && !empty($_POST['search_code']))
{
    $search_code = $_POST['search_code'];
    global $wpdb;
    $helloworld_id = $wpdb->get_var("SELECT s_image FROM search_code WHERE s_code = $search_code");
    if (empty($helloworld_id)) { 
        echo '<div class="no_results">No results found</div>'; 
    }else{ ?>
        <img src="http://igtlaboratories.com/wp-content/uploads/images/<?php echo $helloworld_id; ?>"style="width:200px;height: auto;">
    <?php }
}
answer Aug 21, 2017 by Deepa
Similar Questions
0 votes

I want to display all the existing categories in my Wordpress page in the bottom of the content and the selected category will be in bold style, as follows:

For example, for an existing post if I selected category2 of 3 existing, then it show like this

category1 category2 category3

<div class="entry-meta">
<span class="term-links">
<?php foreach ( get_the_terms( $post->ID, 'category') as $term ) : 
?>
<a href="<?php echo esc_url( get_term_link( $term->term_id ) ) 
?>"><span class="<?php echo $term->slug ?>"><?php echo $term->name ?>
</span></a>
<?php endforeach; ?>
</span>

<style>
.term-links .category2 {
display: inline-block;
font-weight:bold;
</style>

In the above code only display the selected category, not showing the all category. How can I do this?

0 votes

I have a website in WordPress. In the blog page I have a sidebar. I did add some widgets there but the option in the widgets are not Clickable. How can I make them Clickable?

In below I put the snapshot :

wordpress blog is not clickable

0 votes

I am making a custom plugin for wordpress and i need to create a page in the admin menu. I already have a file called menu_list.php with the following code:

function jps_mail_list_page_entry() {
add_menu_page(
    __('JPS Mailing List'),
    'JPS Mailing List',
    'manage_options',
    'jpsNews_mailinglist',
    'jpsNews_mailing_list',
    'dashicons-email'
);
}
add_action('admin_menu', 'jps_mail_list_page_entry');

function jpsNews_mailing_list() {
    echo 'hello';
}

Now, in the plugin page i have this:

function jpsNews_activate_plugin() {
    include_once(plugin_dir_path(__FILE__).'pages/mailing-list.php');
}
register_activation_hook(__FILE__,'jpsNews_activate_plugin');

Its not working. How can i do it?

0 votes

I want to create a blank white page in my wordpress site.

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...