Categories
WordPress

WordPress Notifications Management

To add email address for receiving comments notifications:

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 Multi Lingual

To set up WordPress Multisite (with sub-directories /sub-domains / local TLD’s) or with the plugin.

Categories
WordPress

WordPress Social Share Tags

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

Categories
WordPress

WordPress Session Variables

To enable use of session variables:

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

WordPress Gutenberg

To use a classic block to display code with Unicode characters.

To make full width video block in the home page, use the CSS:

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

WordPress Slider

To install the plugin.

To create full width video, make use of the 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

To install the plugin.

To apply custom design, make use of the 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;
}

To restrict submit 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;
}

To 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]

To track UTM parameters with the plugin.

Categories
WordPress

WordPress User Posts Limit

To limit post/page creation for author:

add_filter( 'wp_insert_post_empty_content', 'condless_cancel_post_save', 99, 2 );
function condless_cancel_post_save( $maybe_empty, $postarr ) {
	if ( $postarr[ 'ID' ] == 0 && ( $postarr[ 'post_type' ] == 'page' || $postarr[ 'post_type' ] == 'post' ) && ! current_user_can( 'manage_categories' ) && ( new WP_Query( array( 'post_author' => $postarr[ 'post_author' ], 'post_type' => $postarr[ 'post_type' ], 'post_status' => array ( 'any', 'trash', 'draft' ) ) ) )->found_posts >= 3 ) {
		return true;
	}
	return $maybe_empty;
}
Categories
WordPress

WordPress Speed

And the Jazz Artists.

To optimize the WordPress Speed:

  • Turn off Trackbacks & Pingbacks
  • Decrease media size before upload
  • Disable posts Update Services
  • 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

To 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)