Using custom field and category to populate blog page

Community Forums Forums Design Tips and Tricks Using custom field and category to populate blog page

This topic is: not resolved

This topic contains 5 replies, has 3 voices, and was last updated by  Wheeler 1 year, 10 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #9588

    Wheeler
    Participant
    Post count: 24

    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.

    #10265

    Jen Baumann
    Keymaster
    Post count: 444

    Sure, 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/.


    If you need technical support for your theme please file a ticket.

    The forums are community based. Staff only monitors the forum for issues relating to the forum itself and to redirect users to where they need to go.

    #10277

    wpsmith
    Moderator
    Post count: 178

    Jen’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.


    Travis Smith | Recommended StudioPress Developer & Contributor
    WP Smith | @wp_smith | GitHub

    Due to the forums, please paste code using Pastebin, JS Fiddle (for JavaScript) or GitHub.
    How to use Firebug for Designers by SixRevisions

    #10883

    Wheeler
    Participant
    Post count: 24

    Thanks 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.

    #11116

    wpsmith
    Moderator
    Post count: 178

    Using 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.


    Travis Smith | Recommended StudioPress Developer & Contributor
    WP Smith | @wp_smith | GitHub

    Due to the forums, please paste code using Pastebin, JS Fiddle (for JavaScript) or GitHub.
    How to use Firebug for Designers by SixRevisions

    #21792

    Wheeler
    Participant
    Post count: 24

    OK. 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 page

    I’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.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.