Use Wordpress Header for Discourse


Id like to use the following theme:

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’m interested in this too. This guide shows how to add a header: Best way to customize the header

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.

Both WordPress and Discourse output HTML pages, but WordPress is PHP and Discourse is Ruby and Ember.

So no, you can’t drop PHP code into the Admin Customize CP and expect it to work.

HTML, CSS and JavaScript, yes, PHP, no,

That said, you could probably code up an API to get stuff from a PHP file if you needed to.

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.

Yep, that’s possible. You can use your brower’s developer tools to figure out just what CSS styles you need to bring over.

Yes, you could hard code whatever the PHP is outputting to view-source.


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!!

@mrblanco101 Could you please share your work? :slight_smile:

I’m still developing it, but have flagged this email so I will come back and post it when I publish the website in a couple of months :slight_smile:

1 Like

Looking at the same idea atm. Do you have any update if and how you pulled the header over?
Would be great to have your input!

Did y find any solution to get WP header on Discourse ?