Creating a link to the first post in a category

Given a category ID, in this example as the variable $cat_id, you would do this by querying 1 post in that category, ordered by date in ascending order (oldest first). Then use that result to get the permalink to that post. $posts = get_posts( ‘numberposts’ => 1, ‘order’ => ‘ASC’, ‘cat’ => $cat_id, ); if … Read more

Superfish Dropdown menu broken after WP 4.9.5 upgrade

This is the wrong place as this is not a wordpress-related question (well, or the answer isn’t wordpress related), but here is what you do: Get all your files through HTTPS (especially extern files) or just download the extern files and host them on your webspace/server/cloudd. This isn’t only more efficient and resistant to unexpected … Read more

Add active class to wp_nav_menu

You wont need that PHP code to style links to the current page in your nav. WordPress adds a class (current-menu-item) by default on links to the current page. But WordPress does not style the link for you. That would be part of the theme. You can add a rule to the theme’s CSS ( … Read more