How to make Link to go on the first post

I’ll assume by “first” you mean “newest”, since if it’s the oldest, then all you’d need would be the url of that post. $latest = get_posts(array(‘numberposts’ => 1)); $url = get_permalink($latest[0]->ID); echo “<a href=”” . $url . “”>Go to first post</a>”; This should give you a link that always goes to whatever is the latest … Read more

How to prevent WordPress from abbreviating long slugs?

Without you sharing a post title and its resulting slug to see what is happening, I can only guess. But a lot of the time stop words, or extremely common words, are stripped from slugs. This would be words like the, a, an, etc. The plugin Yoast SEO will do this if you’re running it … Read more

Specifically Link To the “Leave a review” part of product page? [closed]

You would probably need to do this with jQuery by detecting the hash value and activating the class based on that. Something like this might work: add_action(‘wp_footer’, ‘custom_review_form_activate’); function custom_review_form_activate() { echo “<script>if (window.location.hash == ‘review_form’) { jQuery(‘.reviews_tab’).addClass(‘active’); }</script>”; } (Of course if your theme or customizations already have some jquery you can add it … Read more

Automatically Add Page Links to Nav Menu

Turns out is_plugin_active is defined in wp-admin/includes/plugin.php so it’s only available within the admin unless I call it. I needed to add include_once( ABSPATH . ‘wp-admin/includes/plugin.php’ ); so my final code was as shown below which I also tidied up a bit too. add_filter(‘wp_nav_menu_items’,’add_about_page_to_menu’, 10, 2); function add_about_page_to_menu( $items, $args ) { include_once( ABSPATH . … Read more