How to Add Ads in WordPress without any plugin
Table of Contents
Introduction
In this tutorial, you will learn how to add advertisements to your WordPress website without using any plugins. This method is useful for optimizing your site’s performance and reducing reliance on third-party tools. By following these steps, you can easily integrate ads directly into your WordPress posts or pages.
Step 1: Access Your WordPress Dashboard
- Log in to your WordPress admin panel.
- Navigate to the page or post where you want to add the ad.
- Click on the "Edit" button to enter the block editor.
Step 2: Add a Custom HTML Block
- In the editor, click on the "+" icon to add a new block.
- Search for the "Custom HTML" block and select it.
- This block allows you to insert HTML code for your ad.
Step 3: Insert Your Ad Code
- Obtain the ad code from your ad network (e.g., Google AdSense).
- Copy the code provided by the ad network.
- Paste the ad code into the Custom HTML block you just added.
<!-- Example Ad Code -->
<div style="text-align:center;">
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-XXXXXXXXXX"
data-ad-slot="XXXXXXXXXX"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
Step 4: Preview and Adjust Your Ad
- Click on the "Preview" button to see how the ad appears on your site.
- Adjust the placement by moving the Custom HTML block to your desired location within the post or page.
- Ensure the ad fits well with your content and does not disrupt the reading experience.
Step 5: Publish or Update Your Post
- Once you are satisfied with the ad placement, click the "Update" or "Publish" button to save the changes.
- Visit your site to confirm the ad displays correctly.
Conclusion
By following these steps, you have successfully added ads to your WordPress website without using any plugins. This method not only simplifies the process but also enhances the performance of your site. For future enhancements, consider experimenting with different ad placements and types to optimize revenue. If you have any questions or need further assistance, feel free to explore the resources provided in the video description.