There’s at least 3 ways you can add text before content on your home page.
- You can use a hooks plugin like Genesis Simple Hooks and paste the text with a conditional tag for the home page in any of the before content hook fields.
- You can create a custom function and simply echo in the text using any of the before content hooks.
- Or you can create a custom widget area which enables you to use the text widget before your content or any other content widget.
Which solution do you think is the best?
Using A Hook Plugin
If the theme you’re using offers a hook plugin, then its probably a good theme in my opinion. Genesis, Thesis and Woo all offer some kind of hook management which makes it easy to add text content anywhere in your theme.
Once you’ve chosen which hook location suits your needs, simple paste the code into the hook plugin field for that hook position.
Here’s an example using the Genesis Simple hooks plugin.
Here’s the above code in the genesis_after_content_sidebar_wrap hook.
Custom Function With Text
Copy this code using the view raw link and paste it at the end of your child themes functions.php file using a text editor like Notepad++.
This code uses the same hook as the Simple Hooks plugin.
Text Before Content Home Page Widget
Paste this code in your child themes functions.php file
Now you can simply drag in the default WordPress text widget and add text or HTML.
Styling Text Before Content
All 3 methods enable you to style your text using the same class.
Here’s some CSS code you can add at the end of your child themes style.css file and modify to your liking.
Simply change the values for each CSS property you want to change to your own liking.
Style Your Text Content Using A Shortcodes Plugin
A pretty smart and cool way to style your new text area is to use a shortcodes plugin.
Then you can simply paste the shortcode into the text widget before your content on the home page.
Another option is to execute a shortcode in a function using any of the genesis hooks. You could also use the shortcode from a plugin like Gravity forms or any other plugin which generates shortcodes.
Add Widget Before Content On Other Pages
Here’s a tutorial about how to add a widget before content on other pages.
How Did You Go?
Get stuck or want to do something a little different?
Was This Tutorial Helpful?