Community Forums › Forums › Archived Forums › Design Tips and Tricks › Add Post Teaser to Widget in a Blog Template Page
Tagged: blog template page, more tag, single post
- This topic has 2 replies, 2 voices, and was last updated 9 years, 8 months ago by DTHkelly.
-
AuthorPosts
-
November 21, 2013 at 6:35 pm #74829SatoriMember
This particular topic has gotten more than it's share of attention both on WordPress.Org and across the web. I've probably read every article existing on it and even turned to the possibility of using a plug-in, but so far, no results. Here is a brief explanation of what I am trying to do:
1) I have a unique landing page for each category using the blog page template.
2) Every landing page will have an "overview post" that I want to feature in a widget area between the header and content areas.
3) The overview post should be displayed as a "teaser" using the More tag from the post to display "Read more..."
4) Only the content should be displayed in this post (without title, author, etc.)Approach #1:
I attempted to create a genesis_post_header hook to query the specific post using the "get_post" function, feeding it the ID based on a custom field stored in the landing page, then storing it in a shortcode. The shortcode is referenced in a Text widget in the custom widget area (below the header). This yields the entire content displayed in the widget with all formatting removed (no paragraph breaks) and the More tag ignored.Approach #2:
I tried to instead use The Loop and check for an article based on its tag attribute, then using "the_content" function to return just the content, ensuring that the global $more variable was set prior to the loop and set to 0. The result was also stored in a shortcode and referenced in the widget area. This also yields full content, no formatting, no More tag.I couldn't find any plugins that would allow custom variables to indicate which article should be displayed. Is this really such a rare requirement? I would think that everyone with a landing page would want to display some sort of overview indicating what the articles are about. That WordPress / Genesis would not provide this capability out of the box is very surprising. The Genesis - Featured Posts widget doesn't work for this purpose because there is no way to make it dynamic. You set the category once and forget about it. I need a single post, dependent on the landing page loaded.
Please, can anyone tell me how to do what I described in the steps above? Perhaps I simply don't understand the WordPress / Genesis hook structure deeply enough to make this work. Maybe the $more variable needs to be hooked in a different place. I don't know. Whatever I do, I just can't get the article to display as a teaser.
On the verge of going back to ExpressionEngine. Help me stay with the WordPress fold.
November 21, 2013 at 6:37 pm #74830SatoriMemberI failed to mention.... I am using WordPress 3.7.1 with the Dynamik Website Builder child theme, based on Genesis. Please let me know if you need any further details.
July 10, 2014 at 6:10 pm #113842 -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.