Kenn Nielsen
Forum Replies Created
-
Forum: Plugins
In reply to: [YITH Request a Quote for WooCommerce] RAQ button on variable productsDo YITH Themes reply in this forum?
Forum: Fixing WordPress
In reply to: htaccess empty search queryWith some further adjustments, everything is now working.
I can now
a) Catch empty search strings and
b) View a specific page for empty searches and 404
all without .htaccess mod_rewrite.The solution is to modify three files.
funtions.php:
// Added by Kenn Nielsen to catch empty searches // https://wordpress.org/support/topic/htaccess-empty-search-query function empty_search() { global $wp_query; if( isset($_GET['s']) && $_GET['s']=='') { $wp_query->set_404(); status_header( 404 ); get_template_part( 404 ); exit(); } } add_action('wp','empty_search');404.php:
<?php get_header(); if( isset($_GET['s']) && $_GET['s']==''){ ?> <!-- Empty Search Results --> <div id="content"> etc.... <!-- Empty Search Results End Here --> <?php }else{ ?> <!-- Page Not Found --> <div id="content"> etc.... <!-- Page Not Found End here --> <?php } get_footer(); ?>And to change the browser title accordingly to the content, modify header.php:
Add the following condition somewhere between the other title conditions, but before the last condition.elseif ( is_404() ) { if( isset($_GET['s']) && $_GET['s']==''){ echo __('Empty search | ', 'theme1741'); bloginfo( 'name' ); } else { echo __('Error 404 | ', 'theme1741'); bloginfo( 'name' ); } }Thanks,
Kenn NielsenForum: Fixing WordPress
In reply to: htaccess empty search queryDone.
It seems to work with a single but..
a) When I try a invalid url http://www.brokenfruit.dk/sdg it return the ’empty search content’ and not the ‘not found content’.
We should differentiate between empty searches and invalid urls.Furthermore, how do one change the browser title to match the corresponding content?
Forum: Fixing WordPress
In reply to: htaccess empty search queryRajesh, I now have disabled the WP Super Cache and it seemed to conflict, and for that I’m sorry.
I now get the correct piece of 404.php, but that is for all pages I visit.
Forum: Fixing WordPress
In reply to: htaccess empty search queryCode added to functions.php in theme folder.
Have a try.// Added by Kenn Nielsen to catch empty searches function empty_search() { global $wp_query; if($_GET['s']=='') { $wp_query->set_404(); status_header( 404 ); get_template_part( 404 ); exit(); } } add_action('wp','empty_search');Forum: Fixing WordPress
In reply to: htaccess empty search queryNow I have this code in 404.php
<?php get_header(); if( $_GET['s'] ==''){ ?>and this in .htaccess:
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php </IfModule> # END WordPressStill does not work though.. 🙁
Are we not missing a condition in the .htaccess file for
if( $_GET['s'] ==''){to work?Forum: Fixing WordPress
In reply to: htaccess empty search queryMy .htaccess is now looking like this: (default wordpress)
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php </IfModule> # END WordPressI don’t know if I left something out, but my goal is to get the empty search working again and to show the correct piece of the 404.php ? 🙂
Forum: Fixing WordPress
In reply to: htaccess empty search queryHi Rajesh,
I have now removed that part of the code and nothing is different from before. Have a try.
Forum: Fixing WordPress
In reply to: htaccess empty search queryForum: Themes and Templates
In reply to: Undefined index in debug modeOkay thanks though ..
Forum: Themes and Templates
In reply to: Undefined index in debug modeThe theme is from template monster..
http://www.templatemonster.com/wordpress-themes/40643.htmlForum: Themes and Templates
In reply to: Undefined index in debug modeLine 371 is:
if (!wp_verify_nonce($_POST['br_meta_box_nonce'], basename(__FILE__))) {
🙂Forum: Plugins
In reply to: Custom search results layoutGOT IT! 🙂
Can you guys confirm if the IF statement is correct?
<div class="excerpt"> <?php $content = get_the_content(); $excerpt = get_the_excerpt(); if (has_excerpt() && !is_search() ) { the_excerpt(); if (is_search()) { $myExcerpt = get_the_excerpt(); $tags = array("<p>", "</p>"); $myExcerpt = str_replace($tags, "", $myExcerpt); echo $myExcerpt; } } else { if(!is_search()) { echo my_string_limit_words($content,135); } else { echo my_string_limit_words($excerpt,135); } } if(is_search()) { echo '<p><span class="search-permalink">'; the_permalink(); echo'</span></p>'; } ?> </div>Forum: Plugins
In reply to: Magicmembers and error messages on frontendThe funny part is, that the standard wordpress login/register works just fine. It is only magic members register form the error won’t show.
So it can only be the plugin, right?
Forum: Plugins
In reply to: Magicmembers and error messages on frontendHi
Thank you for your post!
I have try to disable every plugin, one by one, except magic members and it is still the same 🙁
I did have a security pluigin and i deleted it without luck.