Forums

Personal Fundraiser
[resolved] Page Template (10 posts)

  1. jerryminer
    Member
    Posted 1 year ago #

    Hey John- Just a quick question. When I try to set up my cause page it does not give me the option to use the various page templates available in my theme. I would like to use the full width template, but there are no options to do that. I am assuming that this is a theme issue and not something that I can change through the plug in.

    Again, thanks for your time and dedication. It is appreciated.

    Blessings,
    Jerry Miner

    http://wordpress.org/extend/plugins/personal-fundraiser/

  2. John Kleinschmidt
    Member
    Plugin Author

    Posted 1 year ago #

    If you want to use a different template than the default page template, the only way that I know of to do it is to add code to your theme to use a different template for the campaign pages by hooking into the page_template filter. For example:

    add_filter( 'page_template', 'pfund_custom_page_template' );
    function pfund_custom_page_template($current_template) {
        global $post;
        if ( $post && $post->post_type == 'pfund_campaign' ) {
            return locate_template( 'campaign-template.php' );
        } else {
            return $current_template;
        }
    }
  3. jerryminer
    Member
    Posted 1 year ago #

    Thanks John - I was thinking that would be the case. I will try to find someone that can help do that.

    Again, I appreciate what you do. I am on Cure's pages right now. I love what Cure does and I love the site. I am there trying to see how you lay out things and make things work -but I am more drawn into the stories - the needs and the celebrations.

    Blessings,
    Jerry

  4. jerryminer
    Member
    Posted 1 year ago #

    John, I was able to change this through CSS rather simply. I have to do it for each cause, but it works. Hope this helps someone else.

  5. dambacher
    Member
    Posted 1 year ago #

    I haven't tried this yet, because I haven't needed it, but would it work to just add a template called: single-pfund_campaign.php to your theme directory?

  6. clauds54
    Member
    Posted 11 months ago #

    hello guys , excuse my english but i am from italy
    i need this to but i am not sure i understand were to ad thi filter John,
    cuold you explai it to me a little better ?
    thanks
    Claudio

  7. clauds54
    Member
    Posted 11 months ago #

    ok i did it this is the code i out in functions.php

    /* for template custom*/
    add_filter( 'page_template', 'pfund_custom_page_template' );
    function pfund_custom_page_template($current_template) {
        global $post;
        if ( $post && $post->post_type == 'pfund_campaign' ) {
            return locate_template( 'campaign-template.php' );
        } elseif  ( $post && $post->post_type == 'pfund_cause' ) {
            return locate_template( 'cause-template.php' );
        } else{
            return $current_template;
        }
    }
  8. clauds54
    Member
    Posted 11 months ago #

    ok John one more thing the edit shortcode shows the button but cliking it nothing happens
    ciao....

  9. John Kleinschmidt
    Member
    Plugin Author

    Posted 11 months ago #

  10. brookwoodcommunity
    Member
    Posted 11 months ago #

    With John's and clauds54's code pieces I was able to get my campaign to use the custom template I created, however, I also want to use a different navigation menu with this template. The code I'm using in my theme-actions.php file won't pick up that the campaign is using this custom template.

    elseif ( function_exists('has_nav_menu') && is_page_template('single-pfund_campaign.php') && has_nav_menu('golf-menu') ) {
    		wp_nav_menu( array( 'sort_column' => 'menu_order', 'container' => 'ul', 'menu_id' => 'golf-menu', 'menu_class' => 'nav fl', 'theme_location' => 'golf-menu' ) );

    If I switch out my single-pfund_campaign.php with another custom template I have in use, the menu is displayed properly. Is this something to do with how the template is being assigned to the pfund_campaign post type?

    Thanks for any suggestions.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic