Community Forums › Forums › Archived Forums › Design Tips and Tricks › Using custom field and category to populate blog page
- This topic has 5 replies, 3 voices, and was last updated 11 years, 9 months ago by Wheeler.
-
AuthorPosts
-
January 4, 2013 at 4:07 pm #9588WheelerMember
Hi, I've not had much luck getting an answer to my other question, so thought I'd try this idea to design my "VeloGarage" page. I thought this idea might work to replicate that page on my site now pulling in a custom post type with a custom function ... and I guess it uses the WP loop in a similar way (?)
The problem is, it overwrites the existing introductory content (text and image) on the page. Does anyone know if it is possible to maintain existing content and have the posts begin after that content? Solving this conundrum would enable to convert my site over to Genesis.
Thanks in advance for any help.
January 7, 2013 at 10:11 pm #10265Jen BaumannParticipantSure, here's a tutorial: http://dreamwhisperdesigns.com/genesis-tutorials/add-content-genesis-blog-page-template/ to keep content at the top of the blog page.
If you want to explore custom post types you should check out http://wpsmith.net/ and http://www.billerickson.net/blog/.
January 7, 2013 at 11:18 pm #10277wpsmithMemberJen's post is accurate and a nice shortcut. You will need to create a page_blog.php and place that in your child theme. The current blog page template that is packaged in Genesis by default will not accomplish what you want. Another option would be to do this:
add_action( 'genesis_before_loop', 'child_custom_introduction', 25 );
/**
* Add introduction content to page_blog.php template
*/
function child_custom_introduction() {
if ( is_page_template( 'page_blog.php' ) ) {
global $post;
echo apply_filters( 'the_content', $post->post_content );
}
}
Also see how to use the query_args Easter Egg here and here.
January 10, 2013 at 2:03 am #10883WheelerMemberThanks for the replies (though I'm a bit foggy on the answers). I just realized I need to maintain my custom post types and taxonomy, so need to pull those into the page.
It took me months to figure out how to do this in the present theme (Thesis) ... hope it's not going to take as long to figure out the PHP to use in Genesis.
January 10, 2013 at 8:43 pm #11116wpsmithMemberUsing custom post types and taxonomies is the same across themes since that is primarily a WordPress functionality. The hooks are mainly the only things that will change. If you could be more specific, we could help you better.
February 20, 2013 at 2:37 pm #21792WheelerMemberOK. I got discouraged and put this project on the back burner, but I really need to move my site to something new, so here goes again.
First, thanks to those who have spent the time to try to help.
I want to replicate this page, which pulls in the custom page type "garage" with own taxonomy. Presently, it used this code in the Thesis custom.php (and, of course references the Thesis custom loop):
//display latest teasers on garage page
class garage_page extends thesis_custom_loop {
function page() {
//display normal page if not paged
if(!is_paged()) {
thesis_loop::page();
}
global $wp_query;
//prepare & run new query (no saving needed so it will respond on post_type_archive() conditional and
enable pagination)
$paged = ($wp_query->query_vars['paged'] != 0 ) ? $wp_query->query_vars['paged'] : 1 ;
$args = array(
'post_type' => 'garage',
'posts_per_page' => '14',
'paged' => $paged
);
$garage = query_posts($args);
//display posts
global $thesis_design;
$thesis_design->display['archives']['style'] = 'teasers';
$thesis_design->home['body']['content']['features'] = 0;
thesis_loop::home();
}
}
//check if the garage display needed
function custom_check_garage_page() {
//you need to modify the parameter in the next line to make it work
if(is_page('garage')) {
$garage_page = new garage_page();
}
}
add_action('wp_head','custom_check_garage_page');
//end garage pageI'd really, really like to move to Genesis. I've got everything else on my test site to the point I can live with until I learn more. This barrier is pretty much the only thing holding me back now.
Thanks in advance.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.