May 8, 2013 at 5:27 pm #39980
The After Post Widget only displays on the single (permalink) post page. I’d like it to display at the bottom of my posts on the homepage and in my archives, too.
I’m familiar with conditional tags, but I’m not sure how to make this happen. How do I write a function that will allow for multiple placements of this widget?
EDITED TO ADD — I’d prefer to address this via a function instead of using the Simple Hooks Plugin.May 9, 2013 at 3:23 am #40048
Link to your site please.
And paste the code here (using shortcodes which you find in FAQ No.5) so i can edit it.
May 9, 2013 at 11:40 am #40113
Thanks so much for helping me out with this. Which code would you like me to paste here?May 9, 2013 at 11:59 am #40119
Just the function or the link to the page you got the code.
May 9, 2013 at 12:19 pm #40126
Oh, thanks for clarifying!
Actually, the After Post widget is really just a widgetized area that’s built in to my theme. It might be a part of Genesis, I’m not sure.
If you go to the widgets page, you’ll see on the far right the Primary Sidebar, Header Right, etc. It’s listed there. Instead of using the Simple Hooks plugin, which I intend to delete, I’d like to use this widgetized After Post area.
But for some reason they’ve designed it so that any widgets in that area only display on the single page. I’ve typed in some text as a placeholder so that you can see this. My website is under construction, but I’ll remove that while we work on figuring this out. Here’s a link to my homepage: Hello!!
Please ignore the slow loading photo in the sidebar. It’s just another placeholder, as are the four or five breaks just above the After Post box. I think some conditional tags are needed, which is easy enough, but I’m not sure how to write the function.
Thank you. You’re a big help in these forums.May 9, 2013 at 1:26 pm #40141
You can use this code with any genesis_hook outside the loop:
Code not displaying? Grab it on Github.
Copy the code from the view raw link and paste it at the end of your child themes functions.php file using a code editor like Notepad++.
Change the conditional tag to suit your needs.
May 9, 2013 at 4:24 pm #40183
Brad, this worked perfectly.
For anyone reading this, instead of adding a condition to the existing After Post widget area, he gave me instructions on how to create a custom widget. It shows up on the Appearance > Widgets page.
I swapped the hook with genesis_after_post_content and then added is_single, and now it display exactly where I want it.
This is brilliant. Thank you for taking the time to help me!!May 10, 2013 at 3:00 pm #40369
Brad, I have a question . . .
I’d like the custom widget content to display below all of my full-length posts. Using conditional tags for home and single, this worked just great. The widget content doesn’t show up on my archive or search result pages. But it does show up when you click pagination links at the bottom of my homepage.
The front page displays full-length posts, and I decided to display excerpts on the remaining pages that are accessible via pagination. But those are showing my share links function and the widget.
Here’s a link to a sample archive page, which look nice:
And here’s a link to Page 2 accessed via the homepage pagination links:
How do I target post excerpts via conditional tags? Or is there a way to target anything with /page/ in the link?
Thank you!!May 10, 2013 at 3:33 pm #40382
I’m wondering if is_page can be used and the entire array of numbered pages somehow targeted?
If I add a conditional tag to the custom widget and my share function, this will place the code there, since “true” is the default, I think. So how do I use a condition that blocks the content from displaying if that condition is met?May 10, 2013 at 3:49 pm #40385
If I’m understanding this correctly, array references numbered pages. This codex article says specifying an empty array results in a condition of “true.” So if I use is_page(array()) this means I’m telling the wizard hootchie to insert that content on all numbered pages, instead of removing it, which it’s already doing.
Someone let me know if I should start a new thread to learn how to use conditions. Learning how to use conditions is giving me a condition, I’ll say that much.May 10, 2013 at 3:59 pm #40386
Better yet, can I just target the homepage and single post pages?
The conditions is_home and is_front_page place my share function and custom widget below my excerpts on the numbered pages, so they don’t target just the homepage.May 10, 2013 at 6:41 pm #40406
Here’s the code to insert after your other conditional tags:
`if ( get_query_var( ‘paged’ ) >= 2 )
Someone was kind enough to help with this. I played around with ‘paged’, but not like this. Not even close. She was a huge help.
The topic ‘How do I place the After Post Widget on the homepage?’ is closed to new replies.