Archived topic
bottom div
7 replies · Started by Chad Biggs on November 17, 2014
Hello, how can I place a div on on the bottom of every blog and page? This would be used like a signature, except I will be using two images, one floating left and one floating right.
Your best bet would be to use GP Hooks in the "After Content" area.
You may need a PHP conditional if you only want it to show up on certain pages.
If you want it to show up on all static pages, and single blog posts, you would do this:
<?php if ( is_single() || is_page() ) : ?>
YOUR DIV AND HTML IN HERE
<?php endif; ?>
Let me know if you need more help :)
I have never used a hook before. The line you gave me works with text in the div but I have two issues.
Q1 - How do I use the hook to put it only on post and pages, but not on excerpts?
Q2 - I tried using a div class and placing it in the child theme but it doesn't work. How is the best way to style a hook?
1. The PHP conditional I provided should keep it away from excerpts - did you include the entire snippet I provided? I just tried it on my localhost and it didn't include the div in my excerpts. Make you check the "Execute PHP" checkbox.
2. You can do this:
<?php if ( is_single() || is_page() ) : ?>
<div class="your-class-here">
YOUR DIV AND HTML IN HERE
</div>
<?php endif; ?>
And then in your CSS:
.your-class-here {
.. your styles in here
}
Got it. Thank you so much.
You're welcome!
@tom
What variable/parameters are pass to the "after-content" hook?
Any documentation available?
Just answered your topic:
https://generatepress.com/forums/topic/content-on-hook-generate_after_content/#post-1691909