Site logo

Archived topic

Static Message above blog posts

6 replies · Started by stairscat on November 5, 2018

Viewing posts 1–7 of 7

Hello,

I have a client who wants to have a blog page as his home page, but we thought it would be good to add a static message above all posts that will be displayed all the time. I don't want to do it in form of a sticky blog post because it will have time/date, and username displayed.

How else can I do this? The cleanest way if possible, and also the way that will make the least problems when we update the site in the future…

We use GeneratePress Premium (1.7.2) with the GeneratePress Theme (2.1.4) on Wordpress version 4.9.8.
No Child theme. The site is in maintenance mode so I can not post a link. But we haven't changed much except colours, it's pretty much the default design.

Thank you for your support!

Hello David!

Thanks for your help, I looked at these elements but I can't really find the solution I need. The Hook Element almost does what I need. With the before_main_content hook I can position the text exactly where I want, but I have no design options. The header element has this great design options which I am missing in the hook element. It seems like I can only add PHP or raw text in the hook element.

Another idea I had for what I wanted to do would have been to have the blog posts included in sections, or the other way around, use sections on the blog posts page, but it seems like this doesn't work. The blog posts page will continue to display blog posts only, the content added in sections won't be displayed.

Forget my previous post. For now I copied HTML code from generate press to make it look identical. I am wondering however what will happen when there's an update or design change. So my recommendation is to add an integrated UI where from which you can do the design part yourself, without adding code. (just like in the header element for example, or also is sections, where it works really great)

Thank you!

Hi there,

where did you add the HTML?

Hi,

I added the HTML in the hook element, in before_main_content and used the id that is used for posts. I basically copied this here:

<article id="post" class="post tribe_events type-tribe_events status-publish hentry" itemtype="https://schema.org/CreativeWork" itemscope="itemscope">
	<div class="inside-article">
		
		<header class="entry-header">
			<h1 class="entry-title" itemprop="headline">Text title</h1>		</header><!– .entry-header –>

		
			<div class="entry-summary" itemprop="text">
				<p>Text Content</p>
			</div><!-- .entry-summary -->

			</div><!-- .inside-article -->
</article>

Actually, now that I think of it, this shouldn't be a problem and should work even with updates, since it's linked to GeneratePress. There should be no troubles right?

That code in a hook element will be absolutely fine when the theme updates. Good idea to re-use that code :)

This archived topic is closed to new replies.