Categories
WordPress

WordPress Notifications Management

Add email address for receiving comments notification (update the Email):

add_filter( 'comment_moderation_recipients', 'condless_comment_moderation_recipients', 11, 2 );
add_filter( 'comment_notification_recipients', 'condless_comment_moderation_recipients', 11, 2 );
function condless_comment_moderation_recipients( $emails, $comment_id ) {
	array_push( $emails, "info@example.com" );
	return $emails;
}
Categories
WordPress

WordPress Social Share Tags

Set effective social media sharing with the plugin. Use images of at least 200px width and height and 1:1 till 1:2 ratio.

Categories
WordPress

WordPress Session Variables

Enable the use of session variables:

add_action( 'init', 'condless_activate_session', 1 );
function condless_activate_session() {
        if( ! session_id() ) {
                session_start();
        }
}
Categories
WordPress

WordPress Gutenberg

Use a classic block to display code with Unicode characters.

Make full width video block in the home page (CSS):

.home .wp-block-video { min-width: 100vw !important; }
Categories
WordPress

WordPress Slider

Intall the plugin and create full width video (CSS):

.wp-video, video.wp-video-shortcode, .mejs-container, .mejs-overlay.load {
	width: 100% !important;
	height: 100% !important;
}
.mejs-container {
	padding-top: 56.25%;
}
.wp-video, video.wp-video-shortcode {
	max-width: 100% !important;
}
video.wp-video-shortcode {
	position: relative;
}
.mejs-mediaelement {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
}
.mejs-controls {
	display: none;
}
.mejs-overlay-play {
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	width: auto !important;
	height: auto !important;
}
Categories
WordPress

WordPress Contact Form

Install the plugin and apply custom design (CSS):

.wpcf7-form {
	background: #dcc8a5;
	padding: 10px 20px;
	border: 2px solid #f6efdf;
	border-radius: 7px;
	max-width: 300px;
}
 
.wpcf7-form p {
	color: #4f2a0f;
	margin-bottom: 5px;
}
 
.wpcf7-form input, .wpcf7-form textarea, .wpcf7-form select {
	background: #f6efdf;
	padding: 5px 7px;
	margin: 4px 0 8px 0;
	border: 3px solid #ccb58c;
	color: #4f4f4f;
	border-radius: 7px;
}
 
.wpcf7-form .wpcf7-submit {
	background: #4f2a0f;
	padding: 5px 15px;
	color: #fff;
	min-width: 100px;
}
 
.wpcf7-form input[type="submit"]:hover {
 	background: #000;
}

Restrict submition to 1 form per email- install the plugin and use:

add_filter( 'wpcf7_validate_email*', 'condless_email_validation_filter', 20, 2 );
function condless_email_validation_filter( $result, $tag ) {
	if ( Flamingo_Contact::find( array( 's' => trim( $_POST['your-email'] ) ) ) ) {
		$result->invalidate( $tag, __( 'Sorry, that email address is already used!' ) );
	}
        return $result;
}

Save attachments in folder restricted to logged-in users only- install the plugin and create .htaccesss file in the wpcf7-submissions directory that inside the uploads directory with the content:

Options -Indexes
RewriteEngine On
RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC]
RewriteRule ^(.*)$ - [R=403,L]
Categories
WordPress

User Posts Limit

Install the plugin and create user posts limit.

Categories
WordPress

WordPress Speed

And the Jazz Artists.

Optimize the WordPress Speed:

  • Turn off Trackbacks & Pingbacks
  • Decrease media size before upload
  • Disable posts Update Services
  • Look after slow queries with the plugin
  • Limit autosaves and revisions- add the directives to the wp-config.php file:
define('AUTOSAVE_INTERVAL', 300 );
define('WP_POST_REVISIONS', false );

As you probably have noticed- Pastorius, Carter, Valdés, and all other WordPress Version names, are names of popular jazz artists, inspired by WordPress core developers, who share a love of jazz music.

Categories
WordPress

WordPress SEO

Improve the SEO for the WordPress:

  • Make the website and the theme responsive
  • Config permalink by post name and the media path without date
  • Set the URL slugs in English
  • Speed up the WordPress
  • Redirect visitors to the appropriate address (with/without https and www)
Categories
WordPress

WordPress Popups

Install the plugin.

In WooCommerce notify the customer product page about discount ineligibility since purchase not enough items from it- add the Auto Open trigger, targeting the desired product id page, and the custom conditions (update the product id and the quantity for discount):

add_filter( 'pum_get_conditions', 'condless_pum_cart_product_quantity_conditions' );
function condless_pum_cart_product_quantity_conditions( $conditions ) {
        return array_merge( $conditions, array(
                'password_page_unlocked' => array(
                        'group'    => __( 'Products', 'woocommerce' ),
                        'name'     => __( 'Products', 'woocommerce' ) . ': ' . __( 'Cart', 'woocommerce' ) . ' ' . __( 'Quantity', 'woocommerce' ),
                        'callback' => 'cart_product_quantity',
                ),
        ) );
}
function cart_product_quantity() {
        foreach ( WC()->cart->get_cart() as $cart_item ) {
                if ( '772' === $cart_item['product_id'] && 3 > $cart_item['quantity'] ) {
                                return true;
                }
        }
        return false;
}

In WooCommerce update the customer while purchase temporary out of stock product (for simple products)- Use the “Add To Cart button classes” option in the plugin, create popup with the name simple_is_on_backorder1, targeting All Products, in the content insert the [current_add_to_cart] shortcode and notification about that he gonna add product which is temporary out of stock, if AJAX archive page option is enabled create another popup with trigger Click Open on .archive_is_on_backorder1 and the option “do not prevent…” and notification about that he just added product which is temporary out of stock, if not use the code:

add_filter( 'woocommerce_loop_add_to_cart_args', 'condless_add_class', 10, 2 );
function condless_add_class( $args, $product ) {
	if ( $product->is_type( 'simple' ) && $product->is_on_backorder() && ! is_product() && 'no' === get_option( 'woocommerce_enable_ajax_add_to_cart' ) ) {
		$product_id = $product->get_id();
		$args['class'] .= ' popmake-archive_backorder-' . $product_id;
		if ( isset( $product->get_availability()['availability'] ) ) $out = '<div>' . $product->get_availability()['availability'] . '</div>' . '<a href=' . $product->add_to_cart_url() . '>' . $product->add_to_cart_text() . '</a>';
		echo do_shortcode( "[popup id='archive_backorder-" . $product_id . "']" . $out . "[/popup]" );
	}
	return $args;
}