How to handle Delete option in Nextjs

const handleDelete = async () => {   // Prompt the user for confirmation before proceeding with the deletion   const confirmDelete = window.confirm(“Are you sure you want to delete?”);   // Check if the user confirmed the deletion   if (confirmDelete) {     try {       // Replace ‘YOUR_API_ENDPOINT’ and ‘YOUR_DELETE_PATH’… Continue reading How to handle Delete option in Nextjs

How to set tooltip for a lottie in Nextjs

Adding tooltips to interactive elements, such as Lottie animations, can significantly enhance the user experience by providing context and guidance. In our Next.js project, you can add the necessary dependencies and set up theme switching. // pages/index.jsimport React, { useState, useEffect } from ‘react’;import { useTheme } from ‘next-themes’; export default function Home() {const {… Continue reading How to set tooltip for a lottie in Nextjs

How to fetch list of Authors from WordPress

WordPress provides a robust set of functions to interact with user data, and one such function is wp_list_authors. This function allows us to retrieve and display a list of all authors on the site with various customization options. Parameters in wp_list_author wp_list_authors accepts an array or string of arguments ($args) to tailor the output according… Continue reading How to fetch list of Authors from WordPress

How to Force a Page Refresh in Next.js

To force a page refresh in Next.js, we can utilize the next/router module to programmatically navigate to the current page with different query parameters. This triggers a full reload of the page. Here’s an example of how we can achieve this: import { useRouter } from ‘next/navigation’;const MyComponent = () => {const router = useRouter();const handleRefresh =… Continue reading How to Force a Page Refresh in Next.js

Use of domparser

The DOMparser is a built-in JavaScript object that provides a way to parse XML or HTML source code from a string into a DOM (Document Object Model) structure. The DOM represents the document as a tree of objects, where each object corresponds to a part of the document, such as elements, attributes, and text. Sometimes… Continue reading Use of domparser

How to navigate between pages in Nextjs

In Next.js, a page is a React Component exported from a file in the pages directory. Pages are associated with a route based on their file name. For example, in development: pages/index.js is associated with the / route. pages/posts/first-post.js is associated with the /posts/first-post route. Create a New Page Create the posts directory under pages. Create a… Continue reading How to navigate between pages in Nextjs

How to change image on dark/light mode in Nextjs

In Nextjs we can change the images according to the dark mode or light mode. The display property can be used to toggle images according to mode change. Provided that the theme provider class is installed in your project, and that the dark /light mode is working fine, then the following code can be used… Continue reading How to change image on dark/light mode in Nextjs

Bbpress plugin

bbPress is intentionally simple yet infinitely powerful forum software.  bbPress is easy to integrate, easy to use, and is built to scale with the growing community. To install bbpress From your WordPress dashboard Visit ‘Plugins > Add New’ Search for ‘bbPress’ Activate bbPress from your Plugins page. (You will be greeted with a Welcome page.)… Continue reading Bbpress plugin

How to use ‘he’ library in Nextjs

he (for “HTML entities”) is a robust HTML entity encoder/decoder written in JavaScript. It supports all standardized named character references as per HTML, handles ambiguous ampersands and other edge cases just like a browser would, has an extensive test suite, and — contrary to many other JavaScript solutions — he handles astral Unicode symbols just… Continue reading How to use ‘he’ library in Nextjs