Posted on Leave a comment

WooCommerce echo address pin-code/ City zip from Login User

WooCommerce offers a streamlined shipping address system, enabling customers to complete a shipping address form, which is then automatically stored in the database. This process includes capturing essential details like the postcode (zip code), city, and additional relevant information.

In this post, we provide concise codes for WooCommerce, featuring built-in validation that aids in the identification of suitable shipping methods during the checkout process. Furthermore, we delve into the functionality of WooCommerce, specifically highlighting how it can echo the address details, such as the current address pin-code and city zip code, from the login user’s profile.

<?php
$customer_id = get_current_user_id();

if ( ! wc_ship_to_billing_address_only() && wc_shipping_enabled() ) {
	$get_addresses = apply_filters(
		'woocommerce_my_account_get_addresses',
		array(
			'shipping' => __( 'Shipping address', 'woocommerce' ),
		),
		$customer_id
	);
}

?>

<?php foreach ( $get_addresses as $name => $address_title ) : ?>
	<?php

		$address = wc_get_account_formatted_address( $name );

	?>
<?php endforeach; ?>

<?php

echo get_user_meta( $customer_id, $name . '_postcode', true )."<br>";
echo get_user_meta( $customer_id, $name . '_city', true );

?>

This code specifically retrieves the shipping address, postal code (ZIP code), and city of the logged-in user, then promptly echoes the details in a direct format, resembling something like (110001 and Delhi). The information acquired comprises the entire range of shipping zone data, which encompasses both the postcode and city.

This accomplishment is facilitated by utilizing the ‘customer_id’ as the object identifier and the ‘billing address’ as a basis for comparison within the ‘my account’ context. The rationale behind this approach lies in the fact that the SQL query yields an array of objects, each possessing these particular attributes.

Posted on Leave a comment

How to Remove WordPress Robots Meta Tag Without Plugin noindex, nofollow

Are you experiencing difficulties with getting your WordPress website crawled or indexed in search results? If you’ve recently manually installed the WordPress setup on your online hosting service, and when you attempt to request indexing through Google Search Console, are you encountering various error messages related to “noindex” or “nofollow” meta tags?

We will guide you through the process of eliminating the “noindex nofollow” meta tag from your WordPress website. This can be achieved by making specific code adjustments within the admin panel, without the need for a plugin. If you possess the technical proficiency to manipulate codes or scripts, the procedure becomes quite straightforward. However, if coding is not your forte, worry not. In this blog post, I have simplified the steps significantly, and you can effortlessly follow the instructions provided below. Accompanying reference images have also been included to assist you in effectively resolving this issue.


Step 1 – Accessing Your cPanel

To initiate the process, you’ll need to log in to your cPanel account. If you’d rather opt for a web-based solution to manage your files, cPanel offers a built-in File Manager.

To reach the File Manager, start by logging in to your hosting cPanel. Simply click the “cPanel Login” button, and you’ll be directed to your cPanel dashboard.

We will show you how to remove meta name=’robots’ content=’noindex nofollow’ in WordPress using replace some code inside the admin panel Step 1 Log into your cPanel

We will guide you through the process of removing the “meta name=’robots’ content=’noindex nofollow'” tag in WordPress by replacing a certain piece of code within the admin panel. Here’s the first step: Log in to your cPanel.

Step 2 – Navigating the cPanel File Manager

Upon accessing the File Manager, you’ll find yourself in the primary directory of your account. Typically, your focus will be on website files, which are situated within the “public_html” directory in most cases.

We will show you how to remove meta name=’robots’ content=’noindex nofollow’ in WordPress using replace some code inside the admin panel Step 1 Log into your cPanel

Step 3 – Locating the wp-includes File

Once you’ve accessed the public_html directory, your next step is to locate the folder named “wp-includes.” Simply double-click on this folder. Amidst the multitude of folders and files, don’t fret. Take a moment to steady yourself, then effortlessly employ the keyboard shortcut Ctrl+f. Type in “general-template.php.”

Voila, you’ll now spot the file named “general-template.php.” Proceed to download this file to your system. For further clarity, refer to the image provided below.

We will show you how to remove meta name=’robots’ content=’noindex nofollow’ in WordPress using replace some code inside the admin panel Step 1 Log into your cPanel


Step 4 – Modifying the general-template.php File

Within this file, you’ll encounter two distinct functions. To pinpoint these functions, open the file using a text editor on your desktop computer. Once the file is open, utilize the Ctrl+f shortcut to facilitate your search. Look for the line mentioned below:

1 – Find this first code and replace with just bellow this:

function wp_no_robots() {
	if ( get_option( 'blog_public' ) ) {
		echo "<meta name='robots' content='noindex,follow' />\n";
		return;
	}

	echo "<meta name='robots' content='noindex,nofollow' />\n";
}
We will show you how to remove meta name=’robots’ content=’noindex nofollow’ in WordPress using replace some code inside the admin panel Step 1 Log into your cPanel

1.1 – Replace first with this code:

function wp_no_robots() {
	if ( get_option( 'blog_public' ) ) {
		echo "<meta name='robots' content='index,follow' />\n";
		return;
	}
	echo "<meta name='robots' content='index,follow' />\n";
}

2 – Find this second code:

function wp_sensitive_page_meta() {
	?>
	<meta name='robots' content='noindex,noarchive' />
	<meta name='referrer' content='strict-origin-when-cross-origin' />
	<?php
}

2.2 – Replace Second with this code:

function wp_sensitive_page_meta() {
	?>
	<meta name='robots' content='index,archive' />
	<meta name='referrer' content='strict-origin-when-cross-origin' />
	<?php
}
We will show you how to remove meta name=’robots’ content=’noindex nofollow’ in WordPress using replace some code inside the admin panel Step 1 Log into your cPanel

Now, substitute this code with our provided reference code. This adjustment will enhance your website’s SEO, aligning with Google’s recommendations for improved focus and webpage indexing.

Step 5 – Uploading the Modified general-template.php File via File Manager

Navigate to the top toolbar and select the “Upload” option. This action will open a new tab, prompting you to click the “Select” button. This button allows you to locate the modified file on your local computer. Once you’ve successfully located the desired file, proceed by clicking the “Open” button to initiate the upload process.

We will show you how to remove meta name=’robots’ content=’noindex nofollow’ in WordPress using replace some code inside the admin panel Step 1 Log into your cPanel

Once this process is successfully completed, return to your website for a comprehensive check. Access the Search Console and proceed to resubmit the URL you previously attempted. If you’ve diligently replaced all codes as instructed, you should notice a remarkable shift. The URL submission will now resonate with a distinctly different tune. Upon submitting the URL, the inspection report should be devoid of any warnings or error messages, particularly those related to indexing and crawlability. This newfound status will empower you to confidently “Request Indexing.”

I trust this guidance proves valuable. Google strongly emphasizes the importance of directing your focus towards optimizing web page indexing for the Googlebot search engine crawler. This necessitates the presence of an intuitive navigation system and lucid URLs on your website.

Please be mindful: Whenever you undertake a WordPress Dashboard upgrade or update, remember that this code can be replaced with the “noindex, nofollow” variant (as provided by wordpress.org for dashboard codes). Simply follow the same procedure to effectuate the code replacement.

Posted on Leave a comment

Google Translator Website Change Language API System Integrate

Enhance Your Website with Language Conversion using Google Translator: Discover the Convenience of Adding Google Translator to Your Local Language Website

Are you looking to make your website more accessible to a global audience? The Google Translator tool offers a seamless solution. By integrating Google Translator into your website, you can effortlessly enable language conversion, ensuring that your content resonates with readers worldwide.

Unlock the Power of Multilingual Communication: With Google Translator, the language barrier becomes a thing of the past. Your website will be equipped to dynamically translate its content into over 90 languages, utilizing the robust capabilities of Google Translate’s automatic conversion.

Simple Integration, Instant Impact: Our user-friendly translation button generator empowers you to seamlessly incorporate translation buttons onto your website. Once implemented, these buttons allow users to trigger translations effortlessly. By simply clicking on a designated button or flag, visitors to your website can experience instant translations powered by Google Translate.

Elevate User Experience: Imagine a visitor arriving at your website and instantly being able to consume your content in their preferred language. With Google Translator, you can enhance user experience, attract a wider audience, and foster greater engagement.

Embrace Global Reach: In today’s interconnected world, expanding your website’s reach has never been more crucial. By harnessing the power of Google Translator, you position your website to captivate a diverse array of visitors, regardless of their native language.

Seamless Translation at Your Fingertips: Integrating Google Translator into your website is not only practical but also intuitive. Say goodbye to language barriers and hello to a more inclusive online presence. Implement Google Translator today and unlock the true potential of your website’s global appeal.

How Google Translator API System Integrate Website Change Language Codes

Crafted by Google, Google Translate serves as a dynamic tool designed to seamlessly convert textual content from one language to another within a website. With an extensive selection of languages at your disposal, this platform boasts a remarkably effective, dependable, and user-friendly method for webpage translation.

First Step:

Incorporate the “div” component bearing the identifier “google_translate_element”:

<div id="google_translate_element"></div>

Please copy and paste the following code snippet into the desired location on your website where you intend to display the Google Translate dropdown or language selector. For instance, you can insert this snippet within the <head> section of your main menu.

Second Step:

Include a reference script link in the uppermost section of your website’s header, above all CSS and JavaScript scripts. This step is crucial due to the Google Translate API script’s initial loading requirement, ensuring optimal performance and results.

<script type="text/javascript">
function googleTranslateFunction(){
new google.translate.TranslateElement({pageLanguage:'en', layout:google.translate.TranslateElement.InlineLayout.SIMPLE},'google_translate_element');
} </script>

<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateFunction"></script>

Third Step:

This step is optional, and if you wish to customize the style of the Google Language button, you can follow these instructions. Please copy and paste the provided code into your “style.css” file.

.goog-te-gadget-simple {
 background-color: #6f6f6ffc;
  border-left: 0pxsolid#d5d5d5;
   border-top: 0pxsolid#9b9b9b;
    border-bottom: 0pxsolid#e8e8e8;
   border-right: 0pxsolid#d5d5d5;
  font-size: 7pt;
 display: inline-block;
cursor: pointer;
  margin-top: 11px;
 zoom: 1;
display: inline;
}
.goog-te-gadget-icon {
  margin-left: 2px;
   width: 1px;
  height: 0px;
 border: none;
vertical-align: middle;
}

You can now integrate the Google Language selector dropdown with over 90 languages into your website’s API system.

Posted on Leave a comment

Author Box Without Use no-Plugin with Schema Optimized to WordPress

Would you be interested in incorporating an “Author Box Without Use no-Plugin with Schema Optimized” into your WordPress site? Adding an author bio box can significantly enhance the authenticity of your blog. While many themes offer the convenience of displaying an author bio box through default functionality, certain themes may lack this built-in feature. In such cases, you have the option to manually enable it and showcase the author bio box within your post’s section.

Importantly, the utilization of a plugin is not a mandatory requirement. In this article, we will guide you through the process of enabling the author box without resorting to a plugin, all while ensuring auto Schema Optimization. To delve deeper into this topic, you can explore Schema Markup Best Practices for additional insights.

The Significance of an Author Box

In the context of a website featuring multiple authors or a single author dedicated to blog writing, the introduction of an author bio becomes crucial. An author bio plays a pivotal role in establishing trust with your readers. It goes beyond just providing basic information such as a name and photo; it offers the opportunity to put a human face to the narrative. This humanizing element not only fosters a sense of connection but also contributes to cultivating strong relationships with your readers.

Moreover, the author box serves as a convenient platform to include essential links, such as those to the author’s website, Twitter, and Facebook profiles. By incorporating these links, readers can effortlessly connect and follow the author on various social media platforms. This seamless integration enhances engagement and interaction, creating a well-rounded and interactive experience for your audience.

Step 1: Enter Your Biographical Information

To get started, navigate to your website’s login page and access the wp-admin dashboard. From there, proceed to Users → All Users →

Upon reaching this section, click on Users. Now, hover over the specific user for whom you wish to provide additional information. As the “Edit” button becomes visible, proceed to click on it.

Now, proceed to scroll down until you locate the “Biographical Info” section. Within this section, you’ll find the Biographical Info box where you can input your description. Here, you also have the option to utilize HTML coding to manually insert links to your social media profiles. Feel free to include any relevant information you wish to appear in your author box, and don’t forget to save your changes afterwards.

Step 2: Implementing PHP Code for Optimized Author Bio Box Schema

In this step, we’ll furnish you with the necessary PHP code to seamlessly display the optimized Author Bio Box within your post pages. Follow these instructions to ensure precise implementation:

  1. Navigate to the sidebar menu and access Appearance → Theme Editor.
  2. Locate and select the “single.php” file from the available options.
  3. Insert the provided PHP code in the appropriate location within the file.

By following these steps, you’ll effectively integrate the optimized Author Bio Schema into your post pages.

<div class="site-content">	
<div class="author-box clear" itemprop="author" itemscope="" itemtype="https://schema.org/Person">
<span itemprop="image" alt="Photo of <?php the_author_meta( 'display_name' ); ?>">
<?php if(function_exists('get_avatar')) { echo get_avatar( get_the_author_meta('email'), '100','','author image' ); } ?>
</span>

<div class="author-meta"><h4 class="author-name">
<span>	<a itemprop="url" rel="author" href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" itemprop="name">
<itemscope>About the <?php the_author_meta( 'display_name' ); ?></a>
</span></h4>

<div class="author-desc" itemprop="description">
<?php the_author_meta('description') ?>
</div>
</div>
</div>
</div>


Before you paste the PHP code into the file, it’s important to determine the specific location on the post page where you want the author box to appear. An optimal placement is right below each article, creating an author information box that readers can easily access. This location serves as an effective spot to showcase your author bio.

Now, as you review the contents of the single.php file, follow these straightforward steps:

  1. Open the single.php file.
  2. To locate the ideal insertion point, perform a search using the “Ctrl+f” shortcut and search for the term “comment.”
  3. Once you find the section just above the comment area, you can confidently insert the provided PHP code.

By following these instructions, you’ll seamlessly integrate the author box into the desired position on the post page.

This code efficiently retrieves the author’s details and presents them beneath WordPress posts. We’ve comprehensively outlined the validation process and the method to exhibit the author’s name, Gravatar image, and description for each of these elements.

However, if you find yourself uncertain, revert to the initial step outlined above. It entails a check: if Biographical Info has not been added, the author bio won’t be displayed at all. This ensures a seamless user experience, displaying author information only when relevant details are available.

Step 3: Applying CSS Code for Author Box Styling

Moving forward, we will enhance the appearance of the authors’ bio box by incorporating custom CSS. To achieve the desired styling for your author box, you can insert the following customized CSS code. Don’t hesitate to modify the code to align with your specific preferences.

You have two distinct options for pasting the CSS code to alter the style of the author box:

  1. Access the Appearance → Theme Editor → Stylesheet (style.css) menu and paste the code at the end of the existing code lines.
  2. Alternatively, if you opt for the second method, you can paste the CSS code directly within the same page, single.php. If you choose this approach, remember to enclose the CSS code within style tags like this:
<style>Paste CSS code</style>

CSS code:

.author-box {
    padding: 15px 0 15px 0;
}
.author-box .avatar {
    border-radius: 50%;
    float: left;
    width: 72px;
    height: auto;
    line-height: 0.8;
    margin: 0 15px 0 0;
}
.author-box .author-meta {
    display: table;
}
.author-box .author-meta .author-name {
    font-size: 16px;
    margin-bottom: 5px;
    font-size: 18px;
    padding-bottom: 10px;
}
.author-box .author-meta .author-name a:hover {
    color: rgb(118, 44, 255); /*change color as theme */
}
.author-box .author-meta .author-desc {
    margin-bottom: 5px;
}

Select the method that best suits your workflow and requirements to effortlessly apply the desired style enhancements to the author box.

So, once you’ve incorporated this CSS code into your project, the frontend presentation of your site will resemble the example below:

Conclusion: That’s the process for seamlessly integrating the author bio box without the need for a plugin, all while ensuring schema optimization, into your WordPress site. This article has presented you with a comprehensive guide to effortlessly adding an attractive, captivating, and attention-grabbing author bio box within a matter of minutes. If you find yourself still uncertain and eager to learn more about this topic, please feel free to reach out via the comment section below, and we’ll be more than happy to provide further assistance.

Posted on Leave a comment

How to Add Image Title/alt Tag no plugin WordPress Solve in One Step Image SEO

Enhance Image SEO: Add Title and alt Tags to All WordPress Images in One Simple Step, Is your website filled with images lacking proper titles and alt tag? If you’ve noticed that WordPress doesn’t automatically include title attributes for your post images, it’s time to address this issue and improve your image SEO. Title and alt attributes play a crucial role, providing mouse hover tooltips that significantly enhance readability for your readers.

In this comprehensive tutorial, we will guide you through the process of using a WordPress hook to effortlessly add title tag and alt tag attributes to all your images. With just one step, you can activate title tags for every image on your WordPress site, boosting its overall user experience and SEO performance.

Effortlessly Enhance Your WordPress Images with Title Tags: Adding title attributes to your images is a breeze. While numerous methods exist, I’ll guide you through the most straightforward and up-to-date approach, requiring just three lines of code—no plugins necessary. Follow along as I walk you through the process of adding title tags to your images using this method

What Does “Image Title / alt” Refer To?

In essence, the image title serves as the label for your image. Similar to alt text, it provides both users and search engines with insight into the image’s content. However, unlike alt text, the image title/alt remains hidden when the image is absent or fails to load correctly. Instead, it becomes visible when a user hovers their mouse pointer over the image.

Step 1: Adding Title Tags to All Featured Images

To achieve this, simply insert the following code into your WordPress file located at: wp-includes → media.php

'title' => $attachment->post_title,

You can find this line bellow mention

$default_attr = array(

Paste code an exact location check image bellow

Step 2: Adding Title Tags to All Images within Posts

You can accomplish this by following the same procedure and inserting the code into the WordPress file found at: wp-includes → media.php

title="'.trim( strip_tags( get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) ) ).'" 

You can locate this line as indicated below.

if ( is_string( $sizes ) ) {

Paste code at exact location check image bellow

Upon adding an image to your post, you’ll notice that title attributes are automatically appended, as depicted in the Insert Image screen below. Follow these steps: Select the desired image from the media library. On the right-hand side, a set of text boxes will be visible. Populate the Title text box and then click the “Insert into Page” button.

Please note that the aforementioned techniques will be effective for all images with pre-existing titles. I highly recommend incorporating descriptive titles for each image to enhance the user experience with tooltips upon mouse hover. Ultimately, a well-structured and organized blog or website will pave the way for the success you aspire to achieve in the future.

Posted on Leave a comment

1kb or Less Social Share Buttons for WordPress URLs Without Plugin

By exploring the WordPress repository and generating social share URLs for platforms like Facebook, Twitter, Reddit, LinkedIn, WhatsApp, and more, we offer WordPress users a code solution that seamlessly integrates with your site. This eliminates the need for any manual adjustments, providing your site’s visitors with a convenient means to share or appreciate the content.

Our solution revolves around a remarkably compact file, totaling less than 1kb, housing the entire collection of social share URLs. This minimal file size ensures a simple modification that won’t adversely impact your page loading speed. Recognize that sluggish site performance isn’t merely an inconvenience for users; it can also detrimentally affect your Google Site Ranking and the placement of your pages within the SERP (Search Engine Result Page).

Within this guide, you’ll gain insight into effortlessly crafting social share links or buttons for prominent platforms such as Facebook, Twitter, LinkedIn, and Reddit. These elements can be seamlessly integrated into your WordPress site, as well as in an HTML or PHP version. Facilitating content sharing is of utmost importance, as it contributes to enhancing your website’s overall popularity.

Discover the Optimal Locations for Placing Social Share Links

The conventional approach for situating social share links involves positioning them immediately above and below the main content of your webpage or blog post. This practice applies whether you’re operating within a WordPress environment or utilizing an HTML or PHP framework. By adhering to these straightforward steps, you can effortlessly generate your own social share URLs.

Step 1: Configure the Styling of Social Media Buttons

To initiate the styling process for your social media buttons, follow these steps:

  1. Log in to your WordPress admin panel.
  2. Navigate to “Appearance” and select “Theme Editor.”
  3. Locate and access the “style.css” file.

Once you’re in the “style.css” file, insert the provided code snippet designed for button styling.

.shareon{ width: fit-content;float: left; margin-right: 15px; margin: 15px;}
.social-con{ width: max-content; display: inline-block; padding: 10px 10px 8px 10px; border: 1px solid gainsboro; border-radius: 2px; }
.social-con a{ display: inherit;}
.backco_ svg{ width: 23px; padding: 5px; border-radius: 2px; }
.facebook svg{ background:#3b5998; }
.twitter svg{ background:#55acee;}
.reddit svg{ background:#ff4500;}
.linkedin svg{ background:#007bb5;}
.whatsapp svg{ background:#12af0a;}
.telegram svg{ background:#2ca5e0;}
.pocket svg{ background:#ee4056;}
.blogger svg{ background:#fda352;}

Step 2: Integrate Share Button Where Desired

Embed the HTML code at your preferred location on the page, whether it’s at the top, bottom, or even both sides. Utilize the following code snippet for seamless integration:

<h2 class="shareon">Share on: </h2>
<div class="social-con">
<a href="#facebook" class="facebook backco_" title="Facebook"><svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#FFF" d="M17.78 27.5V17.008h3.522l.527-4.09h-4.05v-2.61c0-1.182.33-1.99 2.023-1.99h2.166V4.66c-.375-.05-1.66-.16-3.155-.16-3.123 0-5.26 1.905-5.26 5.405v3.016h-3.53v4.09h3.53V27.5h4.223z"></path></svg></a>

<a href="#twitter" class="twitter backco_" title="Twitter"><svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#FFF" d="M28 8.557a9.913 9.913 0 0 1-2.828.775 4.93 4.93 0 0 0 2.166-2.725 9.738 9.738 0 0 1-3.13 1.194 4.92 4.92 0 0 0-3.593-1.55 4.924 4.924 0 0 0-4.794 6.049c-4.09-.21-7.72-2.17-10.15-5.15a4.942 4.942 0 0 0-.665 2.477c0 1.71.87 3.214 2.19 4.1a4.968 4.968 0 0 1-2.23-.616v.06c0 2.39 1.7 4.38 3.952 4.83-.414.115-.85.174-1.297.174-.318 0-.626-.03-.928-.086a4.935 4.935 0 0 0 4.6 3.42 9.893 9.893 0 0 1-6.114 2.107c-.398 0-.79-.023-1.175-.068a13.953 13.953 0 0 0 7.55 2.213c9.056 0 14.01-7.507 14.01-14.013 0-.213-.005-.426-.015-.637.96-.695 1.795-1.56 2.455-2.55z"></path></svg></a>

<a href="#reddit" class="reddit backco_" title="Reddit"><svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M28.543 15.774a2.953 2.953 0 0 0-2.951-2.949 2.882 2.882 0 0 0-1.9.713 14.075 14.075 0 0 0-6.85-2.044l1.38-4.349 3.768.884a2.452 2.452 0 1 0 .24-1.176l-4.274-1a.6.6 0 0 0-.709.4l-1.659 5.224a14.314 14.314 0 0 0-7.316 2.029 2.908 2.908 0 0 0-1.872-.681 2.942 2.942 0 0 0-1.618 5.4 5.109 5.109 0 0 0-.062.765c0 4.158 5.037 7.541 11.229 7.541s11.22-3.383 11.22-7.541a5.2 5.2 0 0 0-.053-.706 2.963 2.963 0 0 0 1.427-2.51zm-18.008 1.88a1.753 1.753 0 0 1 1.73-1.74 1.73 1.73 0 0 1 1.709 1.74 1.709 1.709 0 0 1-1.709 1.711 1.733 1.733 0 0 1-1.73-1.711zm9.565 4.968a5.573 5.573 0 0 1-4.081 1.272h-.032a5.576 5.576 0 0 1-4.087-1.272.6.6 0 0 1 .844-.854 4.5 4.5 0 0 0 3.238.927h.032a4.5 4.5 0 0 0 3.237-.927.6.6 0 1 1 .844.854zm-.331-3.256a1.726 1.726 0 1 1 1.709-1.712 1.717 1.717 0 0 1-1.712 1.712z" fill="#fff"></path></svg></a>

<a href="#linkedin" class="linkedin backco_" title="Linkedin"><svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M6.227 12.61h4.19v13.48h-4.19V12.61zm2.095-6.7a2.43 2.43 0 0 1 0 4.86c-1.344 0-2.428-1.09-2.428-2.43s1.084-2.43 2.428-2.43m4.72 6.7h4.02v1.84h.058c.56-1.058 1.927-2.176 3.965-2.176 4.238 0 5.02 2.792 5.02 6.42v7.395h-4.183v-6.56c0-1.564-.03-3.574-2.178-3.574-2.18 0-2.514 1.7-2.514 3.46v6.668h-4.187V12.61z" fill="#FFF"></path></svg></a>

<a href="#whatsapp" class="whatsapp backco_" title="WhatsApp"><svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill-rule="evenodd" clip-rule="evenodd" fill="#FFF" d="M16.21 4.41C9.973 4.41 4.917 9.465 4.917 15.7c0 2.134.592 4.13 1.62 5.832L4.5 27.59l6.25-2.002a11.241 11.241 0 0 0 5.46 1.404c6.234 0 11.29-5.055 11.29-11.29 0-6.237-5.056-11.292-11.29-11.292zm0 20.69c-1.91 0-3.69-.57-5.173-1.553l-3.61 1.156 1.173-3.49a9.345 9.345 0 0 1-1.79-5.512c0-5.18 4.217-9.4 9.4-9.4 5.183 0 9.397 4.22 9.397 9.4 0 5.188-4.214 9.4-9.398 9.4zm5.293-6.832c-.284-.155-1.673-.906-1.934-1.012-.265-.106-.455-.16-.658.12s-.78.91-.954 1.096c-.176.186-.345.203-.628.048-.282-.154-1.2-.494-2.264-1.517-.83-.795-1.373-1.76-1.53-2.055-.158-.295 0-.445.15-.584.134-.124.3-.326.45-.488.15-.163.203-.28.306-.47.104-.19.06-.36-.005-.506-.066-.147-.59-1.587-.81-2.173-.218-.586-.46-.498-.63-.505-.168-.007-.358-.038-.55-.045-.19-.007-.51.054-.78.332-.277.274-1.05.943-1.1 2.362-.055 1.418.926 2.826 1.064 3.023.137.2 1.874 3.272 4.76 4.537 2.888 1.264 2.9.878 3.43.85.53-.027 1.734-.633 2-1.297.266-.664.287-1.24.22-1.363-.07-.123-.26-.203-.54-.357z"></path></svg></a>

<a href="#telegram" class="telegram backco_" title="Telegram"><svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#FFF" d="M25.515 6.896L6.027 14.41c-1.33.534-1.322 1.276-.243 1.606l5 1.56 1.72 5.66c.226.625.115.873.77.873.506 0 .73-.235 1.012-.51l2.43-2.363 5.056 3.734c.93.514 1.602.25 1.834-.863l3.32-15.638c.338-1.363-.52-1.98-1.41-1.577z"></path></svg></a>

<a href="#pocket" class="pocket backco_" title="Pocket"><svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#FFF" d="M16.005 6.244c2.927 0 5.854-.002 8.782 0 1.396.002 2.195.78 2.188 2.165-.015 2.483.116 4.985-.11 7.454-.75 8.204-10.027 12.607-16.91 8.064-3.086-2.037-4.82-4.926-4.917-8.673-.06-2.34-.034-4.684-.018-7.025.008-1.214.812-1.98 2.056-1.983 2.975-.01 5.952-.005 8.93-.007zm-5.037 5.483c-.867.093-1.365.396-1.62 1.025-.27.67-.078 1.256.417 1.732a529.74 529.74 0 0 0 5.09 4.838c.745.695 1.537.687 2.278-.01a473.74 473.74 0 0 0 4.93-4.686c.827-.797.91-1.714.252-2.38-.694-.704-1.583-.647-2.447.17-1.097 1.04-2.215 2.06-3.266 3.143-.485.492-.77.432-1.227-.027a87.392 87.392 0 0 0-3.39-3.225c-.325-.29-.77-.448-1.017-.584z"></path></svg></a>

<a href="#blogger" class="blogger backco_" title="Blogger"><svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#FFF" d="M25.793 14.325l-.166-.344-.277-.214c-.363-.284-2.2.02-2.695-.43-.352-.324-.404-.905-.51-1.69-.197-1.527-.322-1.606-.56-2.122-.866-1.836-3.214-3.217-4.825-3.408h-4.367c-3.436 0-6.244 2.814-6.242 6.248v7.29c0 3.428 2.81 6.238 6.248 6.238h7.174c3.436 0 6.225-2.81 6.244-6.237l.04-5.048-.06-.277zM12.47 11.22h3.464c.66 0 1.195.534 1.195 1.188 0 .653-.54 1.195-1.2 1.195h-3.46c-.66 0-1.194-.542-1.194-1.195 0-.654.535-1.19 1.195-1.19zm7.038 9.526H12.47c-.66 0-1.194-.54-1.194-1.188 0-.654.535-1.19 1.195-1.19h7.04c.655 0 1.19.536 1.19 1.19 0 .646-.535 1.188-1.19 1.188z"></path></svg></a>
</div>

Step 3: Substitution and Linking to Your Content

For Facebook Social Share URL:

https://www.facebook.com/sharer.php?u=[post-url]

For WordPress Replace:

https://www.facebook.com/sharer.php?u=

Twitter Social Share URL:

https://twitter.com/share?url=[post-url]&text=[post-title]&via=[via]&hashtags=[hashtags]

For WordPress Replace:

https://twitter.com/share?url=&text=&via=

Reddit Social Share URL:

https://reddit.com/submit?url=[post-url]&title=[post-title]

For WordPress Replace:

https://reddit.com/submit?url=&title=https://reddit.com/submit?url=[post-url]&title=[post-title]

Linkedin Social Share URL:

https://www.linkedin.com/shareArticle?url=[post-url]&title=[post-title]

For WordPress Replace:

https://www.linkedin.com/shareArticle?url=&title=

WhatsApp Social Share URL:

https://wa.me/?text=[post-title] | [post-url]

For WordPress Replace:

https://wa.me/?text= | 

Telegram Social Share URL:

https://telegram.me/share/url?url=[post-url]&text=[post-title]

For WordPress Replace:

https://telegram.me/share/url?url=&text=

Pocket Social Share URL:

https://getpocket.com/save?url=[post-url]&title=[post-title]

For WordPress Replace:

https://getpocket.com/save?url=&title=

Blogger Social Share URL:

https://www.blogger.com/blog_this.pyra?u=[post-url]&n=[post-title]&t=[post-description]

For WordPress Replace:

https://www.blogger.com/blog_this.pyra?u=&n=&t=

WordPress Social Share URL:

https://wordpress.com/press-this.php?u=[post-url]&t=[post-title]&s=[post-desc]&i=[post-img]

For WordPress Replace:

https://wordpress.com/press-this.php?u=&t=&s=

Evernote Social Share URL:

https://www.evernote.com/clip.action?url=[post-url]&title=[post-title]

For WordPress Replace:

https://www.evernote.com/clip.action?url=&title=

Delicious Social Share URL:

https://delicious.com/save?v=5&provider=[provider]&noui&jump=close&url=[post-url]&title=[post-title]

For WordPress Replace:

https://delicious.com/save?v=5x&provider=&noui&jump=close&url=&title=

StumbleUpon Social Share URL:

https://www.stumbleupon.com/submit?url=[post-url]&title=[post-title]

For WordPress Replace:

https://www.stumbleupon.com/submit?url=&title=

I trust you find the aforementioned URLs valuable for your social sharing buttons. We warmly encourage you to share your button configurations on your website within the comments section. Your feedback is greatly appreciated, and we are eager to hear your thoughts and suggestions for crafting share links or sharing buttons for various other social networks.

Posted on Leave a comment

WordPress cache leverage no plugin browser loading faster .htaccess

Would you like to enhance the performance of your WordPress website with an easy method? You can achieve this by following these straightforward steps. Caching is a technique that boosts your website’s speed. It involves storing cached files in the user’s browser, eliminating the need for repeated downloads. In essence, this leads to quicker loading times as data is already stored in the user’s browser, thus accelerating your WordPress site. Let’s enhance the speed and optimization of your WordPress website immediately.

Step 1: Evaluate Your Website’s Loading Time

Initially, it’s crucial to obtain your website’s speed result as a percentage. This step holds significant importance since, prior to proceeding with any further steps, it allows you to gauge your website’s speed and overall performance. To achieve this, assess your site’s speed by using Google PageSpeed Insights, which will provide you with your current score.

Step 2: Access Your .htaccess File

Locate the .htaccess file in the root directory of your website. If you’re not already in the root directory, navigate to it. In case you can’t find the .htaccess file, follow these steps: Go to the top right corner, click on “Settings,” then enable the option to display hidden files by checking ‘Show all hidden files.’ With this setting enabled, you should be able to access the .htaccess file. Click on it to open and make necessary edits.

Step 3: Modify the .htaccess File

You can copy the provided codes below and paste them into your .htaccess file. To establish expiration times for resources like images, HTML, JavaScript, and CSS files, a minor adjustment to your file is necessary. Choose values that align with your site’s needs; typically, a duration of 1 month suffices.

#EDITMODIFY
#Customize expires caching start - adjust the period according to your needs
<IfModule mod_expires.c>
  FileETag MTime Size
  AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
  ExpiresActive On
  ExpiresByType text/html "access 600 seconds"
  ExpiresByType application/xhtml+xml "access 600 seconds"
  ExpiresByType text/css "access 1 month"
  ExpiresByType text/javascript "access 1 month"
  ExpiresByType text/x-javascript "access 1 month"
  ExpiresByType application/javascript "access 1 month"
  ExpiresByType application/x-javascript "access 1 month"
  ExpiresByType application/x-shockwave-flash "access 1 month"
  ExpiresByType application/pdf "access 1 month"
  ExpiresByType image/x-icon "access 1 year"
  ExpiresByType image/jpg "access 1 year"  
  ExpiresByType image/jpeg "access 1 year"
  ExpiresByType image/png "access 1 year"
  ExpiresByType image/gif "access 1 year"
  ExpiresDefault "access 1 month"
</IfModule>
#Expires caching end

# BEGIN Cache-Control Headers
<IfModule mod_expires.c>
  <IfModule mod_headers.c>
    <filesMatch "\.(ico|jpe?g|png|gif|swf)$">
      Header append Cache-Control "public"  
    </filesMatch>
    <filesMatch "\.(css)$">
      Header append Cache-Control "public"
    </filesMatch>
    <filesMatch "\.(js)$">
      Header append Cache-Control "private"
    </filesMatch>
    <filesMatch "\.(x?html?|php)$">
      Header append Cache-Control "private, must-revalidate"
    </filesMatch>
  </IfModule>
</IfModule>

# Disable ETags
<IfModule mod_headers.c>
	Header unset ETag
</IfModule>

Step 4: Reassess Your Website’s Speed

Conduct another evaluation of your website’s performance by using Google PageSpeed Insights to observe your updated score.

Step 4: Reevaluate Your Website’s Speed

Perform a retest of your website’s speed using Google PageSpeed Insights in order to observe and assess your newly updated score.

References for Further Enhancement: Take into account the tutorials provided below to enhance your website’s speed and optimization more effectively. In the aforementioned steps, we have highlighted various methods to ensure effective browser caching and the reuse of downloaded content.

Posted on Leave a comment

Notification Bar Without Plugin 1kb Simple Paste Code

Many of the WordPress plugins for cookies give consent to unnecessary scripts and code, ultimately leading to a decrease in website performance. This results in slower loading times due to the excessive download of scripts, as well as unwanted CSS and JavaScript elements. I have discovered a single line of code that, when implemented, outperforms WordPress plugins.

Employing this code to create notification bars within WordPress is an effective method for making announcements and enhancing user engagement. To achieve this without affecting your site’s performance, follow the tutorial below on crafting a WordPress notification bar without utilizing a plugin.

Here is how it looks:

<style>.note-left{ float: left; padding: 7px 0px;color: #313131;} #cookies-bar{color: #fff; font-family: inherit;background: #f5f5f5;padding: 15px 23px;position: fixed;bottom: 0;left: 0;width: 100%;margin: 0px;visibility: hidden;z-index: 99999;box-sizing: border-box;box-shadow: 0 -7px 19px -9px #000000c9;}.acpt-rgt{padding: 8px 12px;background: #397aff;border-radius: 8px;float: right; cursor: pointer;}</style>

<p id="cookies-bar"><span class="note-left">We use cookies to offer you a better browsing experience</span><span class="acpt-rgt" onclick="acceptCookie(); return false;">Accept cookies</span></p>

<script>function acceptCookie(){ document.cookie="cookiesclick=1; expires=Fri, 26 Dec 2025 12:00:00 UTC;path=/", document.getElementById("cookies-bar").style.visibility="hidden"; return false; } document.cookie.indexOf("cookiesclick")<0&&(document.getElementById("cookies-bar").style.visibility="visible"); </script>

Paste Code:

Below, you’ll find the HTML, CSS, and JavaScript code that you should utilize for the cookie notification bar. To ensure proper placement, follow these steps:

  1. Log in to your WordPress admin panel.
  2. Navigate to “Appearance” and select “Theme Editor.”
  3. Locate and edit the “footer.php” file.

Insert the provided code in the appropriate section as mentioned above.

Now, you can relish a remarkably swift notification bar without the need for a plugin, completely free of resource-intensive scripts or animations. If you found this guide helpful for creating a WordPress Notification Bar without the use of a plugin by simply pasting the provided code, kindly share your feedback in the comments section below.

Posted on Leave a comment

jQuery Cookies Bar Form Set Cookie WordPress

Creating a Cookies Bar becomes remarkably straightforward, particularly in contrast to conventional JavaScript, when incorporated into a WordPress site using jQuery. This article demonstrates the process of establishing, retrieving, and purging cookies through jQuery, offering an effortless method for WordPress users to adopt and employ.

Within this realm of options for reading, setting, and eliminating cookies, occasions may arise where the extensive feature set is excessive, prompting a preference for a streamlined yet efficient resolution.

I’ve outlined jQuery functions that I find favorable for seamlessly and promptly managing cookie-related tasks. Integrating these functions into a JavaScript file facilitates their utilization.

I have generated a basic trio of files: “index.html” for the webpage structure, “style.css” for styling, and “cookie.js” for JavaScript functionality.

Keep in mind that you have the option to employ jQuery cookies across various platform frameworks, including WordPress.

Step 1: Generate a file named “index.html” (For integrating with WordPress, navigate to Login → Appearance → footer.php)

Initially, an index file is required to execute and establish cookies on your website. (For WordPress users, please copy and paste the contents exclusively within the body tag.)

<!doctype html>
<head>
  <meta charset="utf-8">  
  <title>How to set cookies with JavaScript Demo</title>  
  <link rel="stylesheet" type="text/css" href="style.css" />  
</head>
<body>
  <!-- For WordPress users copy start -->
  <div id="container">
    <div class="message  cookie__set_message  hid__sec">
	  <p>Displayed only the first time you visit this page. Refresh to hide it!</p>
	  
      <p>Even when you refresh the page, the browser remembers your option.</p>
    </div>

    <div class="message  cookie__onclc  hid__sec">
      <p>Set Cookies hide this message, by clicking the  &ldquo;&times;&rdquo; on the right of this box <a href="#?" class="close" title="Hide This Message">&times;</a></p>
      <p>This is a new message. Even when you refresh the page, the browser remembers your option.</p>
    </div>
  </div>

  <footer>
    <div class="reset">To reset, <a href="">remove the cookies</a>.</div>  
  </footer>
  <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
  <script type="text/javascript" src="cookie.js"></script>  
  <script type="text/JavaScript">
    $(document).ready(function() {
      // COOKIES
      if ($.cookie('hide-after-load') == 'yes') {
        $('.cookie__set_message').removeClass('hid__sec');
        $('.cookie__set_message').addClass('hide--first');
      }
      // if the cookie is true, hide the initial message and show the other one
      if ($.cookie('hide-after-click') == 'yes') {
        $('.cookie__onclc').removeClass('hid__sec');
        $('.cookie__onclc').addClass('hide--first');
      }
      // add cookie to hide the first message after load (on refresh it will be hidden)
      $.cookie('hide-after-load', 'yes', {expires: 7 });
      $('.close').click(function() {
        if (!$('.cookie__onclc').is('hide--first')) {
          $('.cookie__onclc').removeClass('hid__sec');
          $('.cookie__onclc').addClass('hide--first');
          $.cookie('hide-after-click', 'yes', {expires: 7 });
        }
        return false;
      })
      //reset the cookies (not shown in tutorial)
      $('.reset a').click(function() {
        if (!$(this).hasClass('clicked')) {
          $(this).addClass('clicked');
          // add cookie setting that user has clicked
          $.cookie('hide-after-load', 'no', {expires: 7 });
          $.cookie('hide-after-click', 'no', {expires: 7 });
        }
        location.reload();
      });
    });
  </script>
<!-- For WordPress users copy start -->
</body>
</html>


Step 2: Generate the “style.css” file (For WordPress, navigate to Appearance → style.css)

body { font-family: "Helvetica Neue", 'Helvetica', sans-serif; color: #666; margin: 1em; line-height: 2; } a:link, a:visited { color: #f00; text-decoration: none; padding-bottom: 0.1875em; } a:hover{ color: #fe580f; cursor: pointer; }
  /* For WordPress Start */ 
  .hide--first > *:first-child {
    display: none;
  }
  .hid__sec > *:last-child {
    display: none;
  }
  /* For WordPress End */ 
  .message { text-align: center; width: 42%; padding: 0 2%; float: left; background: #f5deff; } .message:last-of-type { float: right; } .close { color: #f00; position: absolute; text-transform: lowercase; right: 20px; font-size: 1.5em; top: 10px; line-height: 1; border: none !important; } p.info { font-size: 19px; margin-bottom: 50px; text-align: center; } p.info span { color: #666 } footer:before{ content: ""; display: table; clear: both; } footer { padding-top: 40%; color: #888; text-align: center; }

Step 3: Create the “cookie.js” file

/*!
 * jQuery Cookie Plugin v1.4.0
 * https://github.com/carhartl/jquery-cookie
 *
 * Copyright 2013 Klaus Hartl
 * Released under the MIT license
 */
(function (factory) { if (typeof define === 'function' && define.amd) { define(['jquery'], factory); } else { factory(jQuery); }}(function ($) { var pluses = /\+/g; function encode(s) { return config.raw ? s : encodeURIComponent(s); } function decode(s) { return config.raw ? s : decodeURIComponent(s); } function stringifyCookieValue(value) { return encode(config.json ? JSON.stringify(value) : String(value)); } function parseCookieValue(s) { if (s.indexOf('"') === 0) { s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); } try { s = decodeURIComponent(s.replace(pluses, ' ')); return config.json ? JSON.parse(s) : s; } catch(e) {} } function read(s, converter) { var value = config.raw ? s : parseCookieValue(s); return $.isFunction(converter) ? converter(value) : value; } var config = $.cookie = function (key, value, options) { if (value !== undefined && !$.isFunction(value)) { options = $.extend({}, config.defaults, options); if (typeof options.expires === 'number') { var days = options.expires, t = options.expires = new Date(); t.setTime(+t + days * 864e+5); } return (document.cookie = [ encode(key), '=', stringifyCookieValue(value), options.expires ? '; expires=' + options.expires.toUTCString() : '', options.path ? '; path=' + options.path : '', options.domain ? '; domain=' + options.domain : '', options.secure ? '; secure' : '' ].join('')); } var result = key ? undefined : {}; var cookies = document.cookie ? document.cookie.split('; ') : []; for (var i = 0, l = cookies.length; i < l; i++) { var parts = cookies[i].split('='); var name = decode(parts.shift()); var cookie = parts.join('='); if (key && key === name) { result = read(cookie, value); break; } if (!key && (cookie = read(cookie)) !== undefined) { result[name] = cookie; } } return result; }; config.defaults = {}; $.removeCookie = function (key, options) { if ($.cookie(key) === undefined) { return false; } $.cookie(key, '', $.extend({}, options, { expires: -1 })); return !$.cookie(key); };}));

Please bear in mind that you can execute this code on your local computer by running it through XAMPP or any Apache server. I trust you found this tutorial enjoyable and perhaps gathered some inspiration for your upcoming projects.

Posted on Leave a comment

WordPress Contact Form Enabling Email Delivery Without Plugins

There is a wide range of plugins that can be utilized to incorporate a contact form into your WordPress site. However, it is also possible to achieve this functionality without relying on a plugin by implementing PHP and jQuery code. This approach involves creating a WordPress form builder from scratch, enabling the submission of user information via email to both the user and the website administrator.

To implement a “Start Process” feature and request the creation of a contact form, you will require an HTML form, a small jQuery script, and a PHP file to handle the email delivery process. This setup enables the form to be submitted by the user, triggering an action that sends an email to both the user and the website administrator. Follow the steps below to create a contact form in WordPress without using a plugin, while ensuring email delivery

Step 1: Creating a Page with a Custom Name (e.g., Contact or Contact Us)

To create a page with a custom name, such as “Contact” or “Contact Us,” follow these steps:

  1. Open your web browser and go to your WordPress admin dashboard.
  2. In the left sidebar, click on “Pages.”
  3. From the dropdown menu, select “Add New.”
  4. In the page editor, enter the desired title for your page, such as “Contact” or “Contact Us.”

By following these steps, you will successfully create a custom contact page with the desired name and content, enhancing the overall appearance and functionality of your WordPress website.

Step 2: Building the Form

Now that you have created the “Contact” or “Contact Us” page, let’s proceed to add a basic form with fields for name, email, dropdown, and message. Follow these steps:

  1. Open the WordPress editor for the “Contact” or “Contact Us” page.
  2. Click on the “+” icon to add a new block.
  3. Search for the “Custom HTML” block and select it.
  4. In the Custom HTML block, paste the following code:
<label>Your Name <small id="name_error"></small></label>
<input type="text" name="name" id="name">
<label>Email <small id="email_error"></small></label>
<input type="text" name="email" id="email">
<label>Subject</label>
<select style="width:100%" name="subject" id="subject">
<option>Option-1</option>
<option>Option-2</option></select>
<label>Message</label>
<textarea name="message" id="message"></textarea><br>
<input type="button" value="Submit" id="form_submit">

Save it

Step 3: Data Processing and Error Handling

Our current form appears visually appealing; however, it lacks functionality as it does not include validation or email submission. To address this issue, we need to implement the following steps: first, verify that the form has been submitted, and second, validate whether all fields have been correctly filled or not.

Please paste the following code below. To do this, navigate to “Appearance” and select “Theme File Editor” from the right sidebar. Look for “Theme Files” and locate “footer.php”. Finally, paste the script provided below on the last line of the “footer.php” file.

<script>
(function($){ 
$("#form_submit").click(function(){
if($("#name").val()==""){
$("#name_error").html(" (Please enter your name)");
return false;
}
if($("#email").val()==""){
$("#email_error").html(" (Please enter your email)");
return false;
}
if(!(/^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/.test($("#email").val()))){
$("#email_error").html(" (Invalid email)");
return false;
}
$("#form_submit").val("Please wait...").css("pointer-events","none");
$.ajax({
url: "/demo/data_form.php",
data: 'name='+$("#name").val()+
'&email='+$("#email").val()+
'&subject='+$("#subject").val()+
'&message='+$("#message").val(),
type: 'post',
success: function (response)
{
if(response=="mailsubmit"){
alert("Thank you, Request has been sent successfully - We will contact you soon...");
}			
if(response=="mailnotsend"){
alert("ERROR Message could not be sent!");
}
$("#form_submit").val("Submit").css("pointer-events","");
$("#name").val("");
$("#email").val("");
$("#message").val("");	
}
});
})
})(jQuery);</script>

Please note that modifying theme files directly can be risky, so it is recommended to create a backup of the file before making any changes.

Step 4: Creating PHP Mailer for Both User and Admin

First, navigate to your WordPress directory and locate the file upload section. This can typically be found in the server directory path where the wp-admin folder is located. Once you’ve accessed the file upload section, proceed with the following steps:

  1. Create a new folder called “demo” within the WordPress directory.
  2. Inside the “demo” folder, create a PHP file named “data_form.php”. This step is necessary because we referenced this file’s URL path (“/demo/data_form.php”) in the Ajax script mentioned earlier.
  3. Open the “data_form.php” file and insert the code provided below:
<?php
error_reporting(0);
if(isset($_POST['name'])){
$name=$_POST['name'];
$email=$_POST['email'];
$subject=$_POST['subject'];
$message=$_POST['message'];
$date=date("d-m-Y");
$subject = "New Contact $name";
$tomessage="Thank you for choosing us.. !!<br>
Our expert will contact you soon..!!<br>
keep visit our site.. !!<br>
<a href='https://www.andamantech.com/' target='_blank'>Andaman Tech</a>";
$tosubject = "Thank you $name for conatct us";
$message = '<table width="643" border="0" cellspacing="2" cellpadding="2" style="border: 4px solid #ff810099;border-radius: 34px;margin: 0 auto;">
<tbody><tr><td colspan="2" align="center" style="padding: 10px 0px;"><span style="color: #267dff;font-weight: bold;font-family: Arial, Helvetica, sans-serif;font-size: 20px;"> - Your Company Name - </span></td>
</tr><tr><td colspan="2" align="center" bgcolor="#FFFFFF"><span style="font-size: 16px;font-family: Arial, Helvetica, sans-serif;font-weight: bold;color: #EA5E00;">&nbsp;Contact Details</span></td>
</tr><tr><td colspan="2" bgcolor="#f7f7f7">&nbsp;</td>
</tr><tr><td width="156"><span style="font-family:Arial, Helvetica, sans-serif;font-size:14px;color:#000000;">Name</span></td>
<td width="469"><span style="font-family:Arial, Helvetica, sans-serif;font-size:14px;color:#000000;">';
$message .= $_POST['name'];
$message .='</span></td>
</tr><tr><td><span style="font-family:Arial, Helvetica, sans-serif;font-size:14px;color:#000000;">Email</span></td>
<td><span style="font-family:Arial, Helvetica, sans-serif;font-size:14px;color:#000000;">';
$message .= $_POST['email'];
$message .='</span></td>
</tr><tr><td><span style="font-family:Arial, Helvetica, sans-serif;font-size:14px;color:#000000;">Subject: </span></td>
<td><span style="font-family:Arial, Helvetica, sans-serif;font-size:14px;color:#000000;">';
$message .= $_POST['subject'];
$message .='</span></td>
</tr><tr><td><span style="font-family:Arial, Helvetica, sans-serif;font-size:14px;color:#000000;">Message: </span></td>
<td><span style="font-family:Arial, Helvetica, sans-serif;font-size:14px;color:#000000;">';
$message .= $_POST['message'];
$message .='</span></td>
</tr><tr><td><span style="font-family:Arial, Helvetica, sans-serif;font-size:14px;color:#000000;">Date: </span></td>
<td><span style="font-family:Arial, Helvetica, sans-serif;font-size:14px;color:#000000;">';
$message .= $date;
$message .='</span></td>
</tr><tr><td colspan="2" bgcolor="#f7f7f7">&nbsp;</td></tr><tr><td colspan="2" align="center"><span style="font-family:Arial, Helvetica, sans-serif;font-size:11px;"><a href="http://localhost/wp?ref=mail-service" target="_blank" style="color: #a5a5a5;">Developed by - Andaman Tech</a></span></td></tr></tbody>
</table>';
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: Your website name<[email protected]>'."\r\n";
if(mail("[email protected]",$subject,$message,$headers)) 
{
mail($_POST['email'],$tosubject,$tomessage,$headers);

echo "mailsubmit";
}
else
{
echo "mailnotsend";
}
}

After pasting the code into the “data_form.php” file, save it. You have now successfully created the folder and PHP file in the WordPress directory, which will handle the functionality to send emails to both users who submit the contact form and the admin.

Step 5: Make the necessary modifications to your email id

In order for the email functionality to work correctly, you need to update the email settings. Follow the steps below:

  1. Open the “data_form.php” file in a text editor.
  2. Locate the following line of code:
<[email protected]>
  1. Replace ‘[email protected]’ with the actual email address where you want to receive the contact form submissions. For example:
<[email protected]>

Save the changes to the “data_form.php” file.

With the updated code, the form submission will only proceed if all the required fields are filled and a valid email address is provided. If any errors occur, an appropriate error message will be displayed. Remember to replace ‘[email protected]’ with your actual email address to receive the contact form submissions.

Note: If you are running your website on a local server, the email functionality may not work as expected due to server limitations. However, if you are using an online hosting service, please ensure that you replace the email address with your working email address for the code to function correctly.

I hope you find this article helpful. If you do, please consider sharing it on social media. Additionally, if you notice any mistakes or have suggestions for a tutorial on creating a WordPress contact form with enabling email delivery Without Plugins, which includes sending emails to both the user and admin, please leave a comment below. Your feedback is greatly appreciated.