sophieyanow
Forum Replies Created
-
Thank you for the thorough explanation. Before I saw your response I ended up going the replacement route, with slightly different implementation:
add_filter( 'nav_menu_link_attributes', 'menu_override', 10, 3 ); function menu_override( $atts, $item, $args ) { global $post; $placeholder = $post; $args = array( 'numberposts' => 1, 'offset' => 0, 'orderby' => 'post_date', 'order' => 'DESC', 'post_status' => 'publish', 'fields' => 'ids', 'post_type' => array( 'post' ), // if you want the latest post(blog), page( if you want the latest page published), or 'post', 'page' if you want the latest post or page publish. or any other custom post type you may want/need ); $sorted_posts = get_posts( $args ); $latestpostid = $sorted_posts[0]; $newlink = str_replace("--id--", $latestpostid, $atts[href]); $atts[href] = $newlink; return $atts; }
Definitely learning a lot here!
Forum: Fixing WordPress
In reply to: Can’t pinpoint where empty container is coming fromIt’s not a commercial theme, it’s a GNU licensed theme that has never been supported.
I figured my question was more general, about using developer tools to pinpoint/locate something. Just looking for any dev to give me general advice. If that’s not allowed here then apologies.
Forum: Themes and Templates
In reply to: Displaying Related Posts with Custom Post TypeThanks MichaelH! Awesome. I have very little knowledge of PHP and I’ve forgotten a lot of other programming… but that makes sense. I’ll try it out.
Forum: Themes and Templates
In reply to: WordPress Theme Editor hasn't refreshed index.php fileYeah, I refreshed the page (using CMD + R, I’m on a Mac) and emptied my browser cache. Still no luck. It’s quite bizarre; does WordPress have some kind of internal cache that needs to be refreshed?