Use Wordpress Header for Discourse


#1

Hey,

Id like to use the following theme: Newspaper Demo | The Best News Magazine WordPress 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!


(Robert White) #2

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.


(Mittineague) #3

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.


(Robert White) #4

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.


(Kane York) #5

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


(Mittineague) #6

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

.


(Robert White) #7

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


(Mathias Jensen) #8

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


(Robert White) #9

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:


(Mike) #10

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