Display Related Posts by Category

global $post; if ( ! empty( $post ) ) { $categories = get_the_category( $post->ID ); if ( $categories ) { $category_ids = array(); foreach ( $categories as $category ) { $category_ids[] = $category->term_id; } $query_args = array( ‘category__in’ => $category_ids,…Continue reading

Smooth Scrolling for Anchor Links

document.addEventListener(‘click’, function(e) { // Check if the clicked element is an anchor with href starting with ‘#’ if (e.target.tagName === ‘A’ && e.target.getAttribute(‘href’) && e.target.getAttribute(‘href’).startsWith(‘#’)) { e.preventDefault(); const targetId = e.target.getAttribute(‘href’).slice(1); // Remove the ‘#’ from the href const targetElement…Continue reading