Users are discussing how to integrate a WordPress header—specifically from the Newspaper theme—into Discourse. Fabian initiated the thread seeking to replicate the WordPress header’s hover-based latest news feature in Discourse. mrblanco101 expressed interest and attempted to copy PHP and CSS from WordPress into Discourse’s custom HTML/CSS fields, but discovered PHP code doesn’t work in Discourse since it runs on Ruby/Ember, not PHP Mittineague clarified this and suggested using an API or static HTML instead. mrblanco101 considered using static HTML output from WordPress, which riking and Mittineague confirmed as viable, recommending browser developer tools to extract necessary CSS. Eventually, mrblanco101 reported success after identifying and copying only the required HTML/CSS for the header. Others, including Mathias_Jensen, MikesCafe, and lionx, requested details or updates, to which mrblanco101 promised to share the solution after launching their site in a few months.
As you can see, it shows latest news by hovering over the menu items in the nav bar. Is there any way to implement the whole header including those latest news into the header of discourse? This would be awesome!
I think the tricky bit (for beginner me) is getting the header out of WordPress so that Discourse has everything it needs to make it look the same. This is perhaps more complicated by the fact I use Avada for my WordPress site.
---- Update ----
Have done a bit more digging. In theory would I just need to copy the CSS theme and ‘header.php’ html into the appropriate places in discourse? or is it more complex than this .. .
— Last update before bed —
So that doesn’t seem to work. Discourse doesn’t like it when ‘php’ is in a line of html. Not sure why.
Thanks Mittinegeage, that’s really helpful. I’ll look into the possibility of using an Api. If the header isn’t going to change much could I just get static html from the php and insert that instead? Then just change it if the header gets modified.
Thanks for the help all. I’ve got it. Took a little while to work out which parts of the pages html I needed to copy across to add just the header. But think I’ve got it working!!