Community Forums › Forums › Archived Forums › Design Tips and Tricks › Need static text on blog page
- This topic has 6 replies, 3 voices, and was last updated 10 years, 4 months ago by
nate.
-
AuthorPosts
-
March 19, 2013 at 5:25 am #29378
78inch
MemberHi everyone,
I'm creating a site using Apparition. I created a Blog page and I'd like a few static lines of introduction just before the post snippets. A sticky post doesn't really cut it.
Apparition does not seem to have any such widget area as standard so I tried Genesis Simple Sidebars and created a widget area, but it doesn't show up. (Overruled by the theme?)
I also checked this method http://designsbynickthegeek.com/tutorials/add-widgeted-sidebar but that seems to work throughout the whole site and not just the blog page.
Can anyone help me out? Many thanks in advance.
Jelle
March 19, 2013 at 6:05 am #29380Brad Dalton
ParticipantPaste this code at the end of your child themes functions.php file.
Change the hook to another location if needed.
Use the new class
.text-before-blog {}
for styling.Another way to add text quickly is to install the Genesis Simple Hooks plugin and paste the code which includes a conditional tag for the page i.d into the hook location you want the text to output.
<?php if (is_page('007') ) { ?> <p>Text-Goes-Here</p> <?php } ?>
Add the i.d for your blogs archive page.
Or use the blog page template conditional:
<?php if (is_page_template ('blog.php') ) { ?> <p>Text-Goes-Here</p> <?php } ?>
March 19, 2013 at 6:24 am #2938378inch
MemberTried the last solution and it worked great. Many thanks!
March 19, 2013 at 6:32 am #2938578inch
MemberSorry, too soon. The text I inserted appears on top of the blog now, but also on the other pages. The
<?php
if
(is_page_template (
'blog.php'
) ) { ?>
part doesn't seem to work?
March 19, 2013 at 7:35 am #29391Brad Dalton
ParticipantTry the code in the gist replacing the post i.d.
You will need to find the post i.d for your blog page archive and replace it where the 139 is.
The code snippets are samples and need to be modified with your specific blog page i.d.
https://gist.github.com/braddalton/5195501
March 20, 2013 at 12:59 am #2962778inch
MemberAnd it works - awesome! Thanks for your help, Brad!!
November 11, 2014 at 8:07 pm #131230nate
MemberHi
Thanks for this post. I feel like I am getting close with this but not quite there.
I have the Eleven40 child theme.
I added the code to the functions.php in the editor. This gave me the "text before blog" widget area where I added in what I wanted.
Just to clarify I want this to work on my home page so that I can display the "blogroll" with static stuff above it.
I can get this to work on my other pages - e.g. right now I have the PHP pointing towards my about page and that is working how I would like it to - http://snowboardingprofiles.com/about - This was done by pasting the code and setting the "if( is_page(139) )" to the number of the about page. But what is the number of the Front Page when the front page is set to "Your Latest Posts" in Settings>reading?
Put another way I can't figure out how to point this to the blogroll - i.e. if I go to Settings>>Reading and set to "Your Latest Posts" How do I point the new php in the functions.php so that the content in the "text before blog" widget area will show up on the home page.
I hope I have explained what I mean here correctly.
Any help with this would be very much appreciated.
Sincerely,
Nathan -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.