Jump to content
Sign in to follow this  
hockpunk426

How to Hardcode a theme page

Recommended Posts

hockpunk426

I am looking to hardcode a sentence or two along with an ad banner at the top of a particular template that I have created. Is their a way to put a body into the template so I can add these items??

Share this post


Link to post
Share on other sites
catrina
Yes, there is a way to add HTML using a hook (which is a piece code added to the child theme's functions.php page). In which area of the page do you want to add this sentence and banner? Also, are you using PlatformBase, the child theme?

Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
hockpunk426
Yes I am using the child theme (PlatformBase). I would like to put it under the navigation bar. Pretty much in the body. If you look at this link http://sampleexhaustsounds.com/pontiac/g8-gt/with-headers Where it says "ALL VIDEOS IN THIS SECTION WILL INCLUDE EITHER LONG TUBE HEADERS (LT) OR SHORTY HEADERS (SH)." I would like that sentence to appear on every page that uses that template in the same location that it is currently in. I would like the ad banner to appear just above that sentence.

Share this post


Link to post
Share on other sites
catrina
That content can be added using a hook for the main content area. If you're not familiar with how to implement a hook, please refer to this topic where I just explained a basic example: http://www.pagelines.com/forum/discussion/18264/footer-text#Item_6

Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
hockpunk426
Ok so I have written the hook, how do I apply that to the template that I want to add it to?

Share this post


Link to post
Share on other sites
hockpunk426
The hook that I wrote is as follows add_action('pagelines_before_maincontent','header_sentance'); function header-sentance(){ ?> ALL VIDEOS IN THIS SECTION WILL INCLUDE EITHER LONG TUBE HEADERS (LT) OR SHORTY HEADERS (SH).

Share this post


Link to post
Share on other sites
hockpunk426
note: when I wrote this into my function.php file it crashed the site so something must be off.

Share this post


Link to post
Share on other sites
catrina
Your hook is close to being correct. Here is the corrected one: [code]add_action('pagelines_before_maincontent', 'header_sentence'); // ---> uncomment to load //add_action('pagelines_before_maincontent', 'header_sentence'); // function name function header_sentence(){ ?> ALL VIDEOS IN THIS SECTION WILL INCLUDE EITHER LONG TUBE HEADERS (LT) OR SHORTY HEADERS (SH). Themes before adding the code?

Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
hockpunk426
My site runs on the PlatformBase theme already so that should be ok. I posted it just below the example that was given. I actually found a screen cast you guys made that was very helpful http://screencast.com/t/1SXcuKsvu How does my "with_headers" theme page recognize this. I want to make sure this doesn't effect all other pages.

Share this post


Link to post
Share on other sites
hockpunk426
Yeah, that worked, I updated it with the new code you provided (thank you) and it works but its on all pages now instead of just the ones I specify.

Share this post


Link to post
Share on other sites
catrina
Can you tell me which pages where you [b]don't[/b] want the sentence to appear?

Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
hockpunk426
I dont want it on the home page, or any of the pages that pertain to "without headers", or any of the question pages. The site is pretty much built on three templates, the default, with headers, and without headers. I will have a hook for "with headers" and "without headers" that will allow me to place an ad at the top of each page as well as a sentence that explains what "with headers" and "without headers" is all about.

Share this post


Link to post
Share on other sites
hockpunk426
Is there not a way to complete this for a single page theme?

Share this post


Link to post
Share on other sites
Rob
All you needed to do was to create your template, adding a universal, content or full width sidebar where you wanted it to appear specifically on that template, above the content, and save. Add a text widget for your ad code and another for your text, making sure you have each wrapped in unique divs. Use CSS to style and position the ad and text. Since it would apply ONLY to that template, it would not appear on your homepage or any section where that template isn't used.

Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
hockpunk426
Yes! That is exactly what I am looking for! That worked awesome! Thank you!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×