User database and a personal questionnaire for each user

I run a WordPress based website for a sports club. Due to current COVID-19 restrictions every member must fill out a form answering Covid related questions before they come to every training session. This is currently done using paper.

I would like to move this process online however, I’m not sure how to achieve this.

I was thinking of getting every user to register for an account on the website and then have them complete the form electronically.

Every member has a membership number. Is there a way they could register by putting in the membership number and making a password? This way I wouldn’t have to make all the accounts myself and not everyone can register, only people with an membership number.

I also do not know how to make a form for each user. I would have to be able to keep track of who has completed the form and who hasn’t.

If anyone can help I’d really appreciate it.

How can I properly loop through an array gotten from my wordpress database and display it to my site

I am trying to display some posts information from my database on my live site. I have done the query correctly because I can view the items on the live site. But I need to take three items to display. The post title, the post content which houses the images, and the post id which links to the posts. I seem to have written it correctly but it does not do anything.

This is the code

<?php      global $  wpdb;                    $  results = $  wpdb->get_results( "SELECT * FROM $  wpdb->posts WHERE `post_type`='post' AND `post_status` = 'publish' LIMIT    20" );    foreach ($  results) {       echo "<div class="card">             <div class="img">              <img src="{post_content}" alt="">             </div>             <div class="info">                <h5>{post_title}</h5>             </div>           </div>";   }    //echo "<pre>";print_r($  results);echo"</pre>";                      ?>  

I am quite new to wordpress and PHP in general.

Uncaught Error: Class ‘Redis’ errors on a site I’ve transfered to new hosting

I’ve been given a site that I need to install on my server. The site was made by someone else and it seems to have redis installed.

I get errors such as (paths altered/truncated in the error msg for privacy reasons):

Fatal error: Uncaught Error: Class ‘Redis’ not found in wp-content\object-cache.php:732 Stack trace: #0 wp-content\object-cache.php(171): WP_Object_Cache->__construct() #1 wp-includes\load.php(638): wp_cache_init() #2 wp-settings.php(131): wp_start_object_cache() #3 wp-config.php(94): require_once(‘\path\…’) #4 wp-load.php(37): require_once(‘\path\gree…’) #5 wp-blog-header.php(13): require_once(‘\path\…’) #6 index.php(17): require(‘\path\…’) #7 {main} thrown in wp-content\object-cache.php on line 732

What’s really odd is that they didn’t give me the WP codebase, just the wp-content folders with theme, plugins, uploads.

So the entire wp codebase, wp-config etc are all defaults that I’ve just obtained from the current latest version at

So if the wp-config is as default, how can some redis like system be coming into play? I’ve never had this issue before and transferred 101 pre-build WP sites between servers.

Can anyone assist ?

How do I integrate vanilla Javascript to a wordpress website?

I am new to WordPress but I have been learning to code since February. I am helping a friend add a responsive slider to her WordPress website. I created this slider using HTML, CSS and JS and it works perfectly. However, I am having problems integrating them into WordPress.

The JS code is

const prev = document.querySelector('.prev'); const next = document.querySelector('.next'); const track = document.querySelector('.track'); const carouselWidth = document.querySelector('.carousel-container').offsetWidth; let index = 0; let initialPosition = null; let moving = false; let transform = 0; next.addEventListener('click', ()=>{   index++;   prev.classList.add('show'); = `translateX(-$  {index * carouselWidth}px)`;   if (track.offsetWidth - (index * carouselWidth) < carouselWidth) {     next.classList.add('hide');   } });  prev.addEventListener('click', ()=>{   index--;   next.classList.remove('hide');   if (index === 0) {     prev.classList.remove('show');   } = `translateX(-$  {0}px)` })    const gestureStart = (e) => {   initialPosition = e.pageX;   moving = true;   const transformMatrix = window.getComputedStyle(track).getPropertyValue('transform');   if (transformMatrix !== 'none') {     transform = parseInt(transformMatrix.split(',')[4].trim());   } }  const gestureMove = (e) => {   if (moving) {     const currentPosition = e.pageX;     const diff = currentPosition - initialPosition; = `translateX($  {transform + diff}px)`;     } };  const gestureEnd = (e) => {   moving = false; }  if (window.PointerEvent) {   window.addEventListener('pointerdown', gestureStart);    window.addEventListener('pointermove', gestureMove);    window.addEventListener('pointerup', gestureEnd);   } else {   window.addEventListener('touchdown', gestureStart);    window.addEventListener('touchmove', gestureMove);    window.addEventListener('touchup', gestureEnd);        window.addEventListener('mousedown', gestureStart);    window.addEventListener('mousemove', gestureMove);    window.addEventListener('mouseup', gestureEnd);   }  

This is the code I added to the functions.php file. It adds all the CSS styles correctly.

function responsive_header(){         wp_enqueue_style( 'responsive_header_css', get_template_directory_uri() .'/css/responsiveslider.css' , array() );         wp_enqueue_script('responsive_header', get_stylesheet_directory_uri() . '/js/responsiveslider.js', array(), '',  false);          }     add_action('wp_enqueue_scripts', 'responsive_header'); 

What is weird is that if I add a hello world alert to my script it works but nothing else works. Am i doing this wrong or must I use jquery. I dont know jquery but I can learn it to implement this.

How to preselect and disable specific checkboxes using js/jquery? [closed]

I have checkboxes with randomly generated ids on every page view and want to preselect and disable some of them, so they can not get unchecked anymore.

With a simple script which looks after value="" I’m able to achieve the preselection but if I try to disable it at the same time, it disables all input fields on the page.

I think it is smarter to get the randomly generated ids of the specific checkboxes using my method mentioned above and then put them in a function. But this is where I fail!

What would be your solution if we had this and couldn’t select by id:

<input type="checkbox" id"?" value="check1"> <input type="checkbox" id"?" value="check2"> <input type="checkbox" id"?" value="check3"> 

I would appreciate any help.

How to modify the WooCommerce shop page to tweak the display price without affecting the actual price under the hood?

The woocommerce shop I am working on imports product price as "£ per g", this is correct for the calculation. On the shop page my client would like the price to be displayed as "£ per 100g" so I need to multiply the price by 100. In functions.php I have the following snippet which lets me change what is displayed (as you can see, I have already edited the text to display correctly), does anyone provide help on how to translate this import price to display price?

add_filter( 'woocommerce_get_price_html', 'wb_change_product_html' );     // Change and return $  price_html variable using the $  price and weight amount     let a = 10     function wb_change_product_html( $  price ) {         $  price_html = '<span class="amount">' . $  price . ' per 100g </span>';   // change weight measurement here              return $  price_html;     }          add_filter( 'woocommerce_cart_item_price', 'wb_change_product_price_cart' );     // Change the cart prices with $  price variable and weight amount     function wb_change_product_price_cart( $  price ) {         $  price = $  price . ' per g'; // change weight measurement here              return $  price;     } 

I’m sure that there’s a quick fix here! I have also added a screenshot of the import columns so that the price change I’m looking for can be seen.

enter image description here

how to make my custom gallery work in wordpress

So am creating a custom theme in WordPress and looking to achieve this enter image description here

I was able to output my category but not too sure how to output the remaining information. As you can see from the image below for each category there is a recent blog post on the left and then other blog post in the same category on the right.

Below is my code please advise what am doing wrong.

<?php  global $  post;     $  args = array(        'posts_per_page' => 4,        'post_type'     => 'post',        'orderby' => 'ASC',                );                        $  query = new WP_Query($  args);             while($  query->have_posts()): $  query->the_post();             $  taxonomy = 'category';             $  term = wp_get_post_terms($  post->ID, $  taxonomy);             ?>                                                 <!-- Left Details Caption -->                                         <div class="col-xl-6 col-lg-12">                                             <div class="whats-news-single mb-40 mb-40">                                                 <div class="whates-img">                                                     <?php the_post_thumbnail('small');?>                                                 </div>                                                 <div class="whates-caption">                                                     <h4><a href="latest_news.html"><?php the_title();?></a></h4>                                                     <span>by <?php the_author();?>   -   <?php echo esc_html(get_the_date()); ?></span>                                                     <p><?php the_excerpt();?></p>                                                 </div>                                             </div>                                         </div>                                           <!-- Right single caption -->                                          <div class="col-xl-6 col-lg-12">                                             <div class="row">                                                 <!-- single -->                                                 <div class="col-xl-12 col-lg-6 col-md-6 col-sm-10">                                                     <div class="whats-right-single mb-20">                                                         <div class="whats-right-img">                                                         <?php the_post_thumbnail('small');?>                                                         </div>                                                         <div class="whats-right-cap">                                     <?php if ($  term && !is_wp_error($  term)) :?>                                         <?php foreach ($  term as $  serv_terms) :?>                                                             <span class="colorb"><?php echo $  serv_terms->name;?></span>                                         <?php endforeach; endif;?>                                                             <h4><a href="<?php the_permalink();?>"><?php the_title();?></a></h4>                                                             <p><?php echo esc_html(get_the_date()); ?></p>                                                          </div>                                                     </div>                                                 </div>                                                                                          </div>                                         </div>                          <?php endwhile; wp_reset_postdata();?> 

WordPress + Vue — Single page app giving me 404s when I use query params

I’ve got my rest api powered site working really well with Vue. Except for the issue of WordPress and urls.


Search for a name or click on a name and the url updates. Now refresh the page. Everything still works, in that Vue will take over and do all the requests and set things up. But I’m getting a 404 on every page like that.

I don’t really know anything about this whole thing. I tried setting up a redirect plugin but that does what it says — it redirects from back to, which isn’t what I want.

I basically want WordPress to ignore the urls completely — just have index.php (and hence Vue) takeover everything. Basically, not 404 and just pass on through with the url.

I’m not currently using Vue Router at all in my app — just appending query strings and using popstate. I’m wondering if I actually need to be using Vue Router to handle this.