I can replace search text with search icon at chrome developer tool element by replacing
<input type="submit" value="search">
with this:
<button type="submit" id="searchsubmit" />
<span class="icon"><i class="fa fa-search"></i></>
</button>
this is theme searchform.php
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
?><form role="search" method="get" class="pojo-form form-search" action="<?php echo home_url( '/' ); ?>">
<label for="s">
<span class="sr-only"><?php _e( 'Search for:', 'pojo' ); ?></span>
</label>
<input type="search" title="<?php _e( 'Search', 'pojo' ); ?>" name="s" value="<?php echo ( isset( $_GET['s'] ) ) ? $_GET['s'] : ''; ?>" placeholder="<?php _e( 'Search...', 'pojo' ); ?>" class="field search-field">
<button value="<?php _e( 'Search', 'pojo' ); ?>" class="search-submit button" type="submit"><?php _e( 'Search', 'pojo' ); ?></button>
</form>
My question is
How can I modify searchform.php in order to to get the search icon
https://krush.co.il/
<button class="search-submit button" type="submit"><span class="icon"><i class="fa fa-search"></i></span></button>
You don't need to have both the value of the button and the inner html of the button tag. You just want to change the search text with your icon html.
I'm having issues with the default WordPress search bar. The search bar no longer brings up any related post results. Sorting by categories also just results in being sent to blank template pages instead of redirecting to the 404 page.
I haven't been able to find any useful answers or tutorials on how to even begin approaching fixing a broken search bar. All the tutorials just say to install search plugins like Relevanssi, which I tried and it didn't help.
If anyone knows how search query code works in WordPress, any info would be greatly appreciated.
Edit:
This is the website link and searchform.php in question, if that helps any. https://www.animationpagoda.com/
<?php
/**
* Searchform
*
* Custom template for search form
*/
?>
<form method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<div class="large-12 columns">
<div class="collapse">
<div class="large-8 mobile-three columns">
<input type="text" name="s" id="s" placeholder="<?php esc_attr_e( 'Write a keyword...', 'magneti' ); ?>" />
</div>
<div class="large-4 mobile-one columns">
<input type="submit" class="button prefix" name="submit" id="searchsubmit" value="Search" />
</div>
</div>
</div>
</form>
Building my first plugin to Wordpress I came across Rush Frisby's Bootstrap hack, so that you can work with Bootstrap within the admin panel, without conflicting with the Wordpress admin core styles. You'll find it here: https://rushfrisby.com/using-bootstrap-in-wordpress-admin-panel/
I have implemented it in my plugin the way he explained.
You can review my code online at https://github.com/kennnielsen/wordpress_dev
There is just one problem with this part:
.bootstrap-wrapper {
#import (less) url('bootstrap.min.css');
}
The error below will disappear if I remove the (less) from above code, but then the hack is not working as expected - the bootstrap is not loaded within the bootstrap-wrapper.
First of all, I have never really worked with LESS, but I know the basic idea of LESS and how it can ease the work with your CSS.
Nevertheless, when running my plugin, and going to Settings - Custom Login I see the following error:
I have no idea what to do. I have searched the web for answers, but I can't really find a solution nor a fix for this.
Does anyone have an idea on how to solve this?
- and a brief explanation about .map files?
Thank you all in advance!
For you guys that don't want to go to Github, see below code used for the admin page.
<?php
// Meaning of abbreviations:
// clsc = Custom login shortcode
// Runs when plugin is activated
register_activation_hook( PLUGIN_MAIN_FILE, 'clsc_install');
// Create new database fields
function clsc_install() {
$clsc_options = array(
'Login_link' => 'log-in/',
'Login_string' => 'Log in',
'Login_class' => '', // Default is empty to inherit theme styles
'Logout_link' => wp_logout_url( home_url()),
'Logout_string' => 'Log out',
'Logout_class' => '', // Default is empty to inherit theme styles
'Account_link' => 'my-account/',
'Account_string' => 'My Account',
'Account_class' => '' // Default is empty to inherit theme styles
);
add_option('clsc_options_array', $clsc_options, '', 'yes');
}
// Register settings for wordpress to handle all values
function admin_init_register_setting()
{
register_setting('wp_plugin_template-group', 'clsc_options_array');
}
add_action('admin_init','admin_init_register_setting');
// Create admin option page
function add_clsc_option_page() {
add_options_page(
'Custom Login', // The text to be displayed in the title tag
'Custom Login', // The text to be used for the menu
'administrator', // The capability required to display this menu
'custom-login-shortcodes', // The unique slug name to refer to this menu
'clsc_html_page'); // The function to output the page content
}
/* Call the html code */
add_action('admin_menu', 'add_clsc_option_page');
// Enqueue admin styles and scripts
function clsc_enqueue_scripts() {
global $wpdb;
$screen = get_current_screen();
if ( $screen->id != 'settings_page_custom-login-shortcodes' ) {
return; // exit if incorrect screen id
}
wp_enqueue_style( 'custom-shortcodes-styles', plugins_url( 'admin/css/admin_styles.css', dirname(__FILE__) ) );
wp_enqueue_style( 'bootstrap', plugins_url('admin/css/bootstrap.css', dirname(__FILE__) ) );
wp_enqueue_script('admin_js_bootstrap_hack', plugins_url('admin/scripts/bootstrap-hack.js', dirname(__FILE__) ) );
wp_enqueue_script('jquery', plugins_url('admin/scripts/jquery.min.js', dirname(__FILE__) ) );
}
add_action('admin_enqueue_scripts', 'clsc_enqueue_scripts' );
function clsc_html_page()
{
if(!current_user_can('manage_options'))
{
wp_die( __('You do not have sufficient permissions to access this page.','clsc') );
}
?>
<script type="text/javascript">
var default_logout = <?php echo json_encode( wp_logout_url( home_url()) ); ?>;
$(document).ready(function(){
$("#logout-default").click(function(){
$("#logout-field").val(default_logout);
});
});
</script>
<div class="wrap">
<form method="post" action="options.php">
<?php
$options = get_option('clsc_options_array');
settings_fields('wp_plugin_template-group');
do_settings_fields('wp_plugin_template-group');
?>
<div class="bootstrap-wrapper">
<div class="row">
<div class="col-md-12">
<h1><?php _e('Custom Login Shortcode','clsc'); ?></h1>
<p><?php _e('To use for shortcode:','clsc'); ?><br/><span class="shortcode-preview">[custom_login]</span></p>
</div>
</div>
<div class="row" id="login-content">
<div class="col-md-4">
<h5><?php _e('Log in link:','clsc'); ?></h5>
<input name="clsc_options_array[Login_link]" placeholder="<?php _e('Example: log-in/', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Login_link']; ?>" />
</div>
<div class="col-md-4">
<h5><?php _e('Log in string:','clsc'); ?></h5>
<input name="clsc_options_array[Login_string]" placeholder="<?php _e('Example: Log in', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Login_string']; ?>" />
</div>
<div class="col-md-4">
<h5><?php _e('Log in class:','clsc'); ?></h5>
<input name="clsc_options_array[Login_class]" placeholder="<?php _e('Example: login_style', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Login_class']; ?>" />
</div>
</div>
<div class="row top-buffer" id="logout-content">
<div class="col-md-4">
<h5><?php _e('Log out link:','clsc'); ?></h5>
<input id="logout-field" name="clsc_options_array[Logout_link]" placeholder="<?php _e('Example: log-out/', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Logout_link']; ?>" />
<input class="btn btn-default btn-xs" type="button" name="logout-default" id="logout-default" value="<?php _e('Use default logout link','clsc') ?>"/>
</div>
<div class="col-md-4">
<h5><?php _e('Log out string:','clsc'); ?></h5>
<input name="clsc_options_array[Logout_string]" placeholder="<?php _e('Example: Log out', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Logout_string']; ?>" />
</div>
<div class="col-md-4">
<h5><?php _e('Log out class:','clsc'); ?></h5>
<input name="clsc_options_array[Logout_class]" placeholder="<?php _e('Example: logout_style', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Logout_class']; ?>" />
</div>
</div>
<div class="row top-buffer" id="account-content">
<div class="col-md-4">
<h5><?php _e('Account link:','clsc'); ?></h5>
<input name="clsc_options_array[Account_link]" placeholder="<?php _e('Example: my-account/', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Account_link']; ?>" />
</div>
<div class="col-md-4">
<h5><?php _e('Account string:','clsc'); ?></h5>
<input name="clsc_options_array[Account_string]" placeholder="<?php _e('Example: My Account', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Account_string']; ?>" />
</div>
<div class="col-md-4">
<h5><?php _e('Account class:','clsc'); ?></h5>
<input name="clsc_options_array[Account_class]" placeholder="<?php _e('Example: account_style', 'clsc') ?>" class="form-control" type="text" value="<?php echo $options['Account_class']; ?>" />
</div>
</div>
</div>
<?php submit_button( __('Save Changes', 'clsc') ); ?>
</form>
</div>
<?php
}
?>
Suggestion :
It's not a good idea to use minified CSS for developmental purposes also it's hard to debug when there are errors in your CSS Code & more likely sometimes gives parse errors due the fact that the whole code is converted into one line which seems to be not ending at all.
Problem :
Inability of LESS to compile a minified version of Bootstrap is a known problem: http://github.com/less/less.js/issues/2207.
The parser may fail at certain non-CSS-conformant browser-specific hacks (the error message may vary depending on the Bootstrap and/or Less versions). The usual workaround is just to compile non-minified version (note that compiling a minified version does not make too much sense since the result of compilation is not minified CSS anyway)
#Credit Goes To seven-phases-max For The Reference URL
Solution :
Well, The problem seems to be with your Minified bootstrap.min.css file,Try to use the unminified version bootstrap.css and you will have no problem.
I have made login pages outside the wordpress theme folder. The code is running perfectly but there are some errors showing.
Header status showing 404 instead 200.
Body has class error404.
Title is not rendering correctly. I solved it by coding the static javascript line.
Here is my page outside the WP-Theme:
<?php include './Logincheck.php'; require( '../wp-blog-header.php'); ?>
<script>
document.title = "Login - Peerless Institute";
</script>
<?php require( './wp-config.php'); ?>
<div class="main-title">
<div class="container">
<h1 class="main-title__primary">Login</h1>
</div>
</div>
<div class="master-container">
<div class="container page type-page" role="main">
<div id="content">
<div class="login-content">
<form action="" method="post">
<?php echo $ErrorMsg ;?>
<input type="password" maxlength="100" name="passcode" placeholder="Enter Passcode:" />
<input type="submit" value="Go" class="btn btn-primary" />
</form>
</div>
</div>
</div>
</div>
<?php get_footer(); ?>
How to fix this issue ? Please help me out of here.
Some of my developer made rule in .htaccess. I changed it according to my terms. It solved.
Thank you for time and consideration.
I'm using a template for Wordpress that has membership functions built-in, including membership plans.
What I'm trying to do is duplicate the Registration page and have everyone who create an account using the signup form on this page get automatically subscribed to a paid membership plan for free.
So I created a new signup page by duplicating the original one. I asked the developer of the template and he said I need to use this function somewhere on the page to subscribe the users to the paid plan. Here's the function:
ThemexCourse::subscribeUser(5244, $user, true);
5244 is the ID of the paid plan on the site.
Any idea how to configure the signup form using this function so that everyone who signs up gets subscribed to the paid plan?
Here's the sign up form code:
<?php
/*
Template Name: Custom Registration
*/
?>
<?php get_header(); ?>
<?php if(get_option('users_can_register')) { ?>
<h1><?php _e('Register Your Account','academy'); ?></h1>
<form class="ajax-form formatted-form" action="<?php echo AJAX_URL; ?>" method="POST">
<div class="message"></div>
<div class="sixcol column">
<div class="field-wrapper">
<input type="text" name="user_login" placeholder="<?php _e('Username','academy'); ?>" />
</div>
</div>
<div class="sixcol column last">
<div class="field-wrapper">
<input type="text" name="user_email" placeholder="<?php _e('Email','academy'); ?>" />
</div>
</div>
<div class="clear"></div>
<div class="sixcol column">
<div class="field-wrapper">
<input type="password" name="user_password" placeholder="<?php _e('Password','academy'); ?>" />
</div>
</div>
<div class="sixcol column last">
<div class="field-wrapper">
<input type="password" name="user_password_repeat" placeholder="<?php _e('Repeat Password','academy'); ?>" />
</div>
</div>
<div class="clear"></div>
<?php if(ThemexCore::checkOption('user_captcha')) { ?>
<div class="form-captcha">
<img src="<?php echo THEMEX_URI; ?>assets/images/captcha/captcha.php" alt="" />
<input type="text" name="captcha" id="captcha" size="6" value="" />
</div>
<div class="clear"></div>
<?php } ?>
<span class="button-icon register"></span><?php _e('Register','academy'); ?>
<div class="form-loader"></div>
<input type="hidden" name="user_action" value="register_user" />
<input type="hidden" name="user_redirect" value="<?php echo themex_value($_POST, 'user_redirect'); ?>" />
<input type="hidden" name="nonce" class="nonce" value="<?php echo wp_create_nonce(THEMEX_PREFIX.'nonce'); ?>" />
<input type="hidden" name="action" class="action" value="<?php echo THEMEX_PREFIX; ?>update_user" />
</form>
<?php } ?>
<div class="clear"></div>
<?php
$query=new WP_Query(array(
'post_type' => 'page',
'meta_key' => '_wp_page_template',
'meta_value' => 'template-register.php'
));
if($query->have_posts()) {
$query->the_post();
echo '<br />';
the_content();
}
?>
<?php get_footer(); ?>
Such customization belong to the Plugins, not themes indeed. As mention in Customizing registration form codex page you may hook to one of the action hooks, to both customize the registration form and do some action after the form posts. The 3 action hooks are register_form, register_post, user_register.
For your particular question the action hook user_register must be hooked with your function preferably in a plugin.
add_action( 'user_register', 'myplugin_registration_save', 10, 1 );
function myplugin_registration_save( $user_id ) {
....
ThemexCourse::subscribeUser(5244, $user, true);
....
}