- This topic is empty.
-
AuthorPosts
-
March 2, 2015 at 7:38 am #197094
gardenshovel
ParticipantHow can I have it so the first paragraph on my blog is static, it always stays there on every page of the blog?
I’d like to have an introductory paragraph at the top, with a tag list, so ideally it would be editable in WP.
March 2, 2015 at 7:51 am #197097Paulie_D
MemberIt’s not entirely clear what you are after but it sounds like you need to adjust the page PHP template so that it spits out the same “element” (whatever it is) before the rest of the content.
Doesn’t sound like a CSS issue so I’ll move it to the WP / PHP issue;
March 2, 2015 at 8:19 am #197098Senff
ParticipantYou’re going to need a custom post type, and then create a new post of that type that contains the text for that static paragraph.
Then in your single post templates (single.php in a lot of themes, but can be different in other themes), you need to call the contents of that specific static custom post, before the contents of the actual single post.
March 2, 2015 at 10:02 am #197104gardenshovel
ParticipantMarch 2, 2015 at 10:53 am #197111gardenshovel
ParticipantI’m a bit of a novice to this, Senff.
I think you’re saying duplicate single.php and turn that into a custom post type (think that’s incorrect on my part).
Then edit single.php so that it calls the custom type. But, wouldn’t that add the static post to every blog post? I only want it at the top of the blogroll pages.
March 3, 2015 at 1:27 am #197140Senff
ParticipantI think you’re saying duplicate single.php and turn that into a custom post type (think that’s incorrect on my part).
Indeed that’s incorrect. Working with custom post types is not beginner-level stuff, perhaps not novice-level stuff either so if that spins your brain then maybe that’s not the way to go.
Editing the single.php file will affect every single instance of every blog post. Try adding something to that file and see what happens. That should give you an idea what working with that template does.
But, wouldn’t that add the static post to every blog post? I only want it at the top of the blogroll pages.
Well, before you said:
How can I have it so the first paragraph on my blog is static, it always stays there on every page of the blog?
So I’m not sure what you consider the difference between “blogroll pages” and “every page of the blog”.
March 3, 2015 at 12:12 pm #197207gardenshovel
ParticipantAh, they mean the same thing to me, but what I meant was, I don’t want the extra paragraph to be on the individual posts, only at the top of the “feed” pages.
E.g.
Page 1: http://tinyurl.com/obwtzgk
Page 2: http://tinyurl.com/kbpe7w9March 3, 2015 at 1:12 pm #197208Senff
ParticipantThen, instead of having it in the single.php template, you should use another template. Depending on the theme, it could be index.php, blog.php, archive.php, or something else. You’ll have to try a few, I guess.
March 3, 2015 at 7:09 pm #197226gardenshovel
ParticipantUpdate on this (and sort of notes for myself!).
content.php is the template for the blogroll, I took some source code from a different page (Showreel) and pasted that into content.php above the posts, and it works as I want it, it’s just hard coded into the page so I can’t edit it.
This is that code: http://codepen.io/anon/pen/wBxeYm
And this is it in action: http://tinyurl.com/obwtzgk
Now I’m going to look at the code for page.php and find the part that lines up with the CodePen code, and copy it over to content.php instead, I would assume that would give me an editable region, akin to any other paragraph area on the site.
Edit: Ah, it hasn’t worked, it’s put it above every post in the blogroll! I hadn’t scrolled down when I wrote the above :S So content.php is the posts.
March 3, 2015 at 8:04 pm #197227Alen
Participant@gardenshovel, I see that you’re currently editing…
I’ve looked at the HTML and you can’t have two same id’s on a same page. Following is incorrect:
<div id="main" class="site-main"> <div id="main" class="site-main"> <div id="primary" class="content-area">...</div> <div id="primary" class="content-area">...</div> </div> </div>
I’m guessing you just copy/pasted stuff around. If you have the original files you’re working with, and you can post them some where, I can take a quick look and tell you how to add static content. In addition, we can make content editable and I can show you how to do that as well.
March 3, 2015 at 8:05 pm #197228gardenshovel
Participantindex.php is the blogroll page.
index.php calls content.php.
content-single.php is a single post’s content when viewed on it’s own individual page.
I think ideally I’d have my opening paragraph on index.php and content-single.php. That should be easy to copy across once I get the code right!
I’ve taken a section from full-width.php (the template that every other page on the site uses) and stuck that above the posts in index.php and it’s getting there. It inherits the title of the first post in the blogroll at the moment! http://tinyurl.com/obwtzgk
This is the section that I’m trying to adapt to work on it’s own, after the header and above the blogroll: http://codepen.io/anon/pen/ZYjJEg
It requires an article number. The website treats every block of text or post on the site as an article, so I’m not sure how I would create an article to go there that’s “hidden” so to speak.
March 3, 2015 at 8:32 pm #197229gardenshovel
Participant@AlenAbdula here’s some download links.
This: https://onedrive.live.com/redir?resid=A18215371E64B29F%219962 is this: http://tinyurl.com/obwtzgk
This: https://onedrive.live.com/redir?resid=A18215371E64B29F%219961 is this: http://tinyurl.com/lh63ure
And this: https://onedrive.live.com/redir?resid=A18215371E64B29F%219960 is this: http://tinyurl.com/lmeoqbx
March 3, 2015 at 8:40 pm #197230Alen
ParticipantSo you’ve copy/pasted the code found from line #9 to line #24 in
index.php
? And this is the place you wish to add static content?March 3, 2015 at 8:48 pm #197231Alen
ParticipantYou’re using this theme https://wordpress.org/themes/minimalizine
I’ll test it out once I get on my home computer. But just to recap.
- Static content to show up when viewing blogroll
- Static content to show up when viewing single blogroll entry
- Content to be editable via WordPress Admin
Also, how do you have your Reading Settings set?
March 3, 2015 at 9:05 pm #197232gardenshovel
ParticipantYes, line #9 to line #24 is correct. And that’s where I want the static content.
And your bulletpoints are correct also :)
Also, I’m thinking about having the static content on the tag archives page too, and if possible, have the “Blog” menu option stay highlighted when you go away from /blog.
So say you click on an individual blog post or choose a tag, the menu option for “Blog” would stay highlighted with the blue rectangle.
That’s a bit of a slippery slope though perhaps, as then I’d probably want the same thing for the Portfolio sub-pages! Might be a bit too much and unnecessary.
My reading settings are here: http://tinyurl.com/od3sutn
Minimalizine is the theme I was using, but I merged it with a child theme to create “Minimal Blue” :P I haven’t replaced the mentions of “minimalizine” within the files though, only the folder name has changed to “minimalblue”.
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.