It is possible for user refresh webpage and redirect to another url?

I’m building a site wordpress and i want to redirect to a page
when user refresh, redirect home of my site.
It is possible?
this code can be right?

$(window).unload(function()
{
    var reload = confirm("are you sure you want to leave?");
    if(reload)
    {
        location.reload(); // Refresh the site, not needed really.
        location.href = "http://example.com"; // Redirect.
    }
});

Getting value from HTML object in PHP

I have an html object:

<a href="https://website/" class="td-post-category" value="News" >News</a>

Which I get from typing $this->get_category(); in PHP.

My question here is if it is possible to get the value-field(News) from the HTML-object inside of PHP. Something like $this->get_category().value or $this->get_category()->value. Like we could in Javascript.

Or if you know how to “extract” variables from functions. Like if I had a variable named $selected_category_obj_name in the function get_category(), how to get this value when I have written $this->get_category(), how can I get the variable $selected_category_obj_name?

I am new to PHP, so some guiding would be very appreciated.

Need a browser based SSH client … using WordPress [on hold]

I have a network of about 150 users who need to reserve instruments daily using our custom Perl script on a Solaris signup computer that is accessed using an SSH client like Putty. This is a pain point for our users and I wish for them to be able to access the signup computer directly through our webpage without having to download Putty or a plugin for their browser. Is there a server side terminal SSH plugin that preferably can be installed through WordPress that will accomplish this task?

Ideally what I would like is to see the terminal open in a small window or tab of the browser. Prefer professionally maintained and supported softwares vs. free unsupported software.

Remove woocommerce complete or processing email based on order meta

I am trying to remove the processing (or complete) email based on some order meta.

I’m using a POS system and getting customers to pay via the customer invoice email – the initial order status is pending payment. I want to a) test if the order was made using the pos, b) remove either the “processing” or “complete” email.

I can’t seem to get the if statement logic to work. I’m pretty sure the meta key is ‘_pos’ and the value is ‘1’ or ‘0’.

Here’s my myphp screem shot of wp_postmeta

add_action( 'woocommerce_email', 'removing_POS_emails' );
function removing_POS_emails( $email_class, $order_id ) {

     //Remove the Processing email for POS emails
     $pos_test = get_post_meta( $order_id, '_pos', true );
     if ( $pos_test == "1" ) {
         remove_action( 'woocommerce_order_status_pending_to_processing_notification', array( $email_class->emails['WC_Email_Customer_Processing_Order'], 'trigger' ) );
     }
}

Am I missing something? Can post meta be used in the woocommerce_email hook?

If I get the if statement correct I’m confident I can remove the processing/complete email or even change the email class and create a custom processing email.

New input for each item in cart

I am looking for solution for woocommerce cart. I am using order page to display order and checkout elements. At this moment I am searching solution for displaying additional name, surname and email input for each element in cart. In words “each element” I mean that I am selling only one product – changing count of them up or down will add or remove 3 new fields.

Which is a better option, to show streams of data live on your website? [on hold]

Which is a better option, to show streams of data live on your website?
As I can think of, there are only two ways to show live data strings portions on your website-

  1. Frequently updating the source HTML file that directly shows content.
  2. Use MySQL database, PHPMyAdmin, PHP, etc linked to the website that can update new data sections.

I do have some programming knowledge using database thing won’t be that hard for me, and I think as far now, it’s more ‘professional’ option.
..But all I want is strings of data up there…So whichever options will suit better, I can opt it.

I think updating source HTML file and replacing them on the server could be fast(or using WordPress)… but on contrary, my website may not update that fast with new data all over the world at the same time…So using MySQL will at least be stable either there won’t be any data at all or new data.(Yes I will be replacing old data with new on database).

We gonna always have a human inputting new data, so it’ll be same efforts either of the ways- inputting data in WordPress panel/HTML file to be replaced
OR Updating linked MySQL database.

I’ve come here to know most stable and fastest option =)

How to remove thin space between slides on Revolution Slider for wordpress?

I’m using Revolution Slider plugin for wordpress to set a fullscreen slider with simple horizontal slide transition. I can see a thin white space (not border) between each slide during they’re switching and I’d like to remove them ’cause the the slide’s layout is continuous – a slide image continues in another. I’ve been searching for solutions in web for hours but I’ve not finding anything to solve it. Someone knows what could I do? I’m using Dzen template for wordpress.

This image shows the space among slides.

Woocommerce Subscription – enabling completed renewal order email creates website error

When changing a subscription from processing to completed on Woocommerce and updating the order it brings up an HTML 500 Error. When I refresh it comes back up fine and processing.

However, it doesn’t send the Order Renewal Email. When I disable this email and change a subscription from processing to complete, it works fine, but obviously doesn’t send the email.

Has anyone come across this error or know what might be causing it?

Docker: I can’t map ports other than 80 to my WordPress container

I want to map some random port on my computer e.g. localhost:7006 to my WordPress docker container’s port 80. Currently when I change the port of WordPress from 80:80 to 7006:80 it not only stops working on localhost(port 80) but also don’t respond on localhost:7006.

My docker-compose.yml file looks like this:

    version: '3'
services:
  wordpress:
    depends_on:
      - db
    image: wordpress:4.7.1
    restart: always
    volumes:
      - ./wp-content:/var/www/html/wp-content 
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_PASSWORD: p4ssw0rd!
    ports:
      - 80:80 # Expose http and https
      - 8443:443
    networks:
      - wp_nwk
  db:
    image: mysql:5.7
    restart: always
    volumes:
       - db_data:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: p4ssw0rd!
    networks:
      - wp_nwk
  phpmyadmin:
    depends_on:
      - db
    image: phpmyadmin/phpmyadmin
    restart: always
    ports:
      - 7005:80
    environment:
      PMA_HOST: db
      MYSQL_ROOT_PASSWORD: p4ssw0rd!
    networks:
      - wp_nwk
networks:
  wp_nwk:
volumes:
  db_data: